Skip to content

Commit aa54253

Browse files
committed
Fix and test compatability func
1 parent ac8f576 commit aa54253

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

maxminddb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def open_database(database, mode=MODE_AUTO):
3636

3737
def Reader(database): # pylint: disable=invalid-name
3838
"""This exists for backwards compatibility. Use open_database instead"""
39-
open_database(database)
39+
return open_database(database)
4040

4141
__title__ = 'maxminddb'
4242
__version__ = '1.0.0'

tests/reader_test.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,14 @@ class TestFileReader(BaseTestReader, unittest.TestCase):
351351
class TestMemoryReader(BaseTestReader, unittest.TestCase):
352352
mode = MODE_MEMORY
353353
readerClass = [maxminddb.reader.Reader]
354+
355+
356+
class TestOldReader(unittest.TestCase):
357+
358+
def test_old_reader(self):
359+
reader = maxminddb.Reader(
360+
'tests/data/test-data/MaxMind-DB-test-decoder.mmdb')
361+
record = reader.get('::1.1.1.0')
362+
363+
self.assertEqual(record['array'], [1, 2, 3])
364+
reader.close()

0 commit comments

Comments
 (0)