Skip to content

Commit e7131dc

Browse files
committed
Add typing to tests
1 parent a568202 commit e7131dc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/reader_test.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
import ipaddress
55
import os
6-
import sys
76
import threading
87
import unittest
98
from multiprocessing import Process, Pipe
9+
from typing import Union, Type
1010

1111
import mock
1212

@@ -15,7 +15,7 @@
1515
try:
1616
import maxminddb.extension
1717
except ImportError:
18-
maxminddb.extension = None
18+
maxminddb.extension = None # type: ignore
1919

2020
from maxminddb import open_database, InvalidDatabaseError
2121
from maxminddb.const import (
@@ -41,6 +41,9 @@ def get_reader_from_file_descriptor(filepath, mode):
4141

4242

4343
class BaseTestReader(object):
44+
readerClass: Union[
45+
Type["maxminddb.extension.Reader"], Type["maxminddb.reader.Reader"]
46+
]
4447
use_ip_objects = False
4548

4649
def ipf(self, ip):
@@ -563,6 +566,9 @@ class TestExtensionReaderWithIPObjects(BaseTestReader, unittest.TestCase):
563566
class TestAutoReader(BaseTestReader, unittest.TestCase):
564567
mode = MODE_AUTO
565568

569+
readerClass: Union[
570+
Type["maxminddb.extension.Reader"], Type["maxminddb.reader.Reader"]
571+
]
566572
if has_maxminddb_extension():
567573
readerClass = maxminddb.extension.Reader
568574
else:

0 commit comments

Comments
 (0)