Skip to content

Commit 1aa6e2a

Browse files
committed
Add test for byte ASCII IP on Python 2
1 parent 1c9ad5a commit 1aa6e2a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

maxminddb/reader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def __init__(self, database, mode=MODE_AUTO):
4646
* MODE_MEMORY - load database into memory.
4747
* MODE_AUTO - tries MODE_MMAP and then MODE_FILE. Default.
4848
"""
49+
# pylint: disable=redefined-variable-type
4950
if (mode == MODE_AUTO and mmap) or mode == MODE_MMAP:
5051
with open(database, 'rb') as db_file:
5152
self._buffer = mmap.mmap(

tests/reader_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ def test_multiprocessing(self):
243243
def test_threading(self):
244244
self._check_concurrency(threading.Thread)
245245

246+
if sys.version_info[0] == 2:
247+
def test_byte_ip_on_python2(self):
248+
reader = open_database(
249+
'tests/data/test-data/MaxMind-DB-test-decoder.mmdb', self.mode)
250+
record = reader.get(b'::1.1.1.0')
251+
246252
def _check_concurrency(self, worker_class):
247253
reader = open_database(
248254
'tests/data/test-data/GeoIP2-Domain-Test.mmdb',

0 commit comments

Comments
 (0)