summaryrefslogtreecommitdiffstats
path: root/tests/test_cache_invocation.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:07:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 18:07:41 +0000
commit76926159194e180003aa78de97e5f287bf4325a5 (patch)
tree2cea7245cdc3f66355900c820c145eba90598766 /tests/test_cache_invocation.py
parentInitial commit. (diff)
downloadpython-apt-76926159194e180003aa78de97e5f287bf4325a5.tar.xz
python-apt-76926159194e180003aa78de97e5f287bf4325a5.zip
Adding upstream version 2.7.6.upstream/2.7.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_cache_invocation.py')
-rw-r--r--tests/test_cache_invocation.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/test_cache_invocation.py b/tests/test_cache_invocation.py
new file mode 100644
index 0000000..a608034
--- /dev/null
+++ b/tests/test_cache_invocation.py
@@ -0,0 +1,31 @@
+#!/usr/bin/python3
+import unittest
+
+import apt_pkg
+import testcommon
+
+import apt.progress.base
+
+
+class TestCache(testcommon.TestCase):
+ """Test invocation of apt_pkg.Cache()"""
+
+ def test_wrong_invocation(self):
+ """cache_invocation: Test wrong invocation."""
+ apt_cache = apt_pkg.Cache(progress=None)
+
+ self.assertRaises(ValueError, apt_pkg.Cache, apt_cache)
+ self.assertRaises(
+ ValueError, apt_pkg.Cache, apt.progress.base.AcquireProgress()
+ )
+ self.assertRaises(ValueError, apt_pkg.Cache, 0)
+
+ def test_proper_invocation(self):
+ """cache_invocation: Test correct invocation."""
+ apt_cache = apt_pkg.Cache(progress=None)
+ apt_depcache = apt_pkg.DepCache(apt_cache)
+ self.assertNotEqual(apt_depcache, None)
+
+
+if __name__ == "__main__":
+ unittest.main()