Skip to content

Commit

Permalink
Add test case from GitHub #58
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwald committed May 4, 2020
1 parent ee2892b commit f029c7d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/data
Submodule data updated 39 files
+ bad-data/maxminddb-python/bad-unicode-in-map-key.mmdb
+1 −1 source-data/GeoIP2-Anonymous-IP-Test.json
+488 −488 source-data/GeoIP2-City-Test.json
+4,383 −17 source-data/GeoIP2-Country-Test.json
+48 −34 source-data/GeoIP2-Enterprise-Test.json
+112 −69 source-data/GeoIP2-Precision-Enterprise-Test.json
+2,132 −0 source-data/GeoIP2-Static-IP-Score-Test.json
+2,832 −2,832 source-data/GeoIP2-User-Count-Test.json
+ test-data/GeoIP2-Anonymous-IP-Test.mmdb
+ test-data/GeoIP2-City-Test-Broken-Double-Format.mmdb
+ test-data/GeoIP2-City-Test-Invalid-Node-Count.mmdb
+ test-data/GeoIP2-City-Test.mmdb
+ test-data/GeoIP2-Connection-Type-Test.mmdb
+ test-data/GeoIP2-Country-Test.mmdb
+ test-data/GeoIP2-DensityIncome-Test.mmdb
+ test-data/GeoIP2-Domain-Test.mmdb
+ test-data/GeoIP2-Enterprise-Test.mmdb
+ test-data/GeoIP2-ISP-Test.mmdb
+ test-data/GeoIP2-Precision-Enterprise-Test.mmdb
+ test-data/GeoIP2-Static-IP-Score-Test.mmdb
+ test-data/GeoIP2-User-Count-Test.mmdb
+ test-data/GeoLite2-ASN-Test.mmdb
+ test-data/MaxMind-DB-no-ipv4-search-tree.mmdb
+ test-data/MaxMind-DB-string-value-entries.mmdb
+ test-data/MaxMind-DB-test-broken-pointers-24.mmdb
+ test-data/MaxMind-DB-test-broken-search-tree-24.mmdb
+ test-data/MaxMind-DB-test-decoder.mmdb
+ test-data/MaxMind-DB-test-ipv4-24.mmdb
+ test-data/MaxMind-DB-test-ipv4-28.mmdb
+ test-data/MaxMind-DB-test-ipv4-32.mmdb
+ test-data/MaxMind-DB-test-ipv6-24.mmdb
+ test-data/MaxMind-DB-test-ipv6-28.mmdb
+ test-data/MaxMind-DB-test-ipv6-32.mmdb
+ test-data/MaxMind-DB-test-metadata-pointers.mmdb
+ test-data/MaxMind-DB-test-mixed-24.mmdb
+ test-data/MaxMind-DB-test-mixed-28.mmdb
+ test-data/MaxMind-DB-test-mixed-32.mmdb
+ test-data/MaxMind-DB-test-nested.mmdb
+20 −17 test-data/write-test-data.pl
9 changes: 9 additions & 0 deletions tests/reader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,15 @@ def test_nondatabase(self):
):
open_database("README.rst", self.mode)

# This is from https://github.com/maxmind/MaxMind-DB-Reader-python/issues/58
def test_database_with_invalid_utf8_key(self):
reader = open_database(
"tests/data/bad-data/maxminddb-python/bad-unicode-in-map-key.mmdb",
self.mode,
)
with self.assertRaises(UnicodeDecodeError):
reader.get_with_prefix_len("163.254.149.39")

def test_too_many_constructor_args(self):
with self.assertRaises(TypeError):
self.readerClass[0]("README.md", self.mode, 1)
Expand Down

0 comments on commit f029c7d

Please sign in to comment.