From ca19a1977a715359471d104a2adbecfa540f3af5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 14 Oct 2013 17:21:55 +0200 Subject: python/indexrecords.cc: IndexRecords.load() needs to accept bytes as well --- tests/test_paths.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/test_paths.py (limited to 'tests/test_paths.py') diff --git a/tests/test_paths.py b/tests/test_paths.py new file mode 100644 index 00000000..d83ef14b --- /dev/null +++ b/tests/test_paths.py @@ -0,0 +1,29 @@ +# +# Test that both unicode and bytes path names work +# +import unittest + +import apt_pkg + + +class TestPath(unittest.TestCase): + + def setUp(self): + apt_pkg.init() + + def test_index_records(self): + index = apt_pkg.IndexRecords() + index.load(u"./data/misc/foo_Release") + index.load(b"./data/misc/foo_Release") + + hash1, size1 = index.lookup(u"main/i18n/Index") + hash2, size2 = index.lookup(b"main/i18n/Index") + + self.assertEqual(size1, size2) + self.assertEqual(str(hash1), str(hash2)) + self.assertEqual(str(hash1), ("SHA256:fefed230e286d832ab6eb0fb7b72" + + "442165b50df23a68402ae6e9d265a31920a2")) + + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3