Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rpm-software-management/createrepo_c.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAleš Matěj <amatej@redhat.com>2021-03-29 16:00:10 +0300
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>2021-03-29 19:51:44 +0300
commit1306d10b69569ea4a8fcc810999890b2ca3ac8f6 (patch)
tree150c2b6dd76988e80a7e38b1f685d083c116e989 /tests
parentb7424daf58aa5d32f659fa3bc6b4141f8154fb63 (diff)
Allow taking __repr__ (__str__) of closed xmlfile and sqlite (RhBug:1913465)
After closing, the object should still be available to be read, as is standard for other python modules. https://bugzilla.redhat.com/show_bug.cgi?id=1913465 Also adds a simple unit test testing.
Diffstat (limited to 'tests')
-rw-r--r--tests/python/tests/test_sqlite.py1
-rw-r--r--tests/python/tests/test_xml_file.py1
2 files changed, 2 insertions, 0 deletions
diff --git a/tests/python/tests/test_sqlite.py b/tests/python/tests/test_sqlite.py
index 045b0fc..5247a3c 100644
--- a/tests/python/tests/test_sqlite.py
+++ b/tests/python/tests/test_sqlite.py
@@ -56,6 +56,7 @@ class TestCaseSqlite(unittest.TestCase):
self.assertRaises(cr.CreaterepoCError, db.add_pkg, pkg)
self.assertRaises(cr.CreaterepoCError, db.dbinfo_update, "somechecksum")
+ self.assertEqual("<createrepo_c.Sqlite Closed object>", db.__str__())
db.close() # No error should be raised
del db # No error should be raised
diff --git a/tests/python/tests/test_xml_file.py b/tests/python/tests/test_xml_file.py
index 0100d1b..8aa6d5c 100644
--- a/tests/python/tests/test_xml_file.py
+++ b/tests/python/tests/test_xml_file.py
@@ -49,6 +49,7 @@ class TestCaseXmlFile(unittest.TestCase):
self.assertRaises(cr.CreaterepoCError, f.set_num_of_pkgs, 1)
self.assertRaises(cr.CreaterepoCError, f.add_pkg, pkg)
self.assertRaises(cr.CreaterepoCError, f.add_chunk, "<chunk>text</chunk>")
+ self.assertEqual("<createrepo_c.XmlFile Closed object>", f.__str__())
f.close() # No error should be raised
del(f) # No error should be raised