summaryrefslogtreecommitdiff
path: root/tests/test_deps.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_deps.py')
-rw-r--r--tests/test_deps.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_deps.py b/tests/test_deps.py
index e9a75ee2..96bcd57b 100644
--- a/tests/test_deps.py
+++ b/tests/test_deps.py
@@ -6,9 +6,11 @@
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
"""Unit tests for verifying the correctness of check_dep, etc in apt_pkg."""
+import itertools
import unittest
import apt_pkg
+import apt.package
class TestDependencies(unittest.TestCase):
@@ -110,6 +112,22 @@ class TestDependencies(unittest.TestCase):
self.assertEqual(len(depends_this), len(depends_this_too), 1)
self.assertEqual(len(depends_other), len(depends_other_too), 0)
+ def test_dstr(self):
+ """Test apt.package.BaseDependency.__dstr"""
+ dstr = apt.package.BaseDependency._BaseDependency__dstr
+ equal = {"<": {"<<", "<"},
+ "=": {"==", "="},
+ ">": {">>", ">"}}
+ operators = ["<<", "<", "<=", "!=", "=", "==", ">=", ">", ">>"]
+
+ for a, b in itertools.product(equal.keys(), operators):
+ if b in equal[a]:
+ self.assertEqual(dstr(a), b)
+ self.assertEqual(b, dstr(a))
+ else:
+ self.assertNotEqual(dstr(a), b)
+ self.assertNotEqual(b, dstr(a))
+
def testParseDepends(self):
"""dependencies: Test apt_pkg.ParseDepends()."""
if not hasattr(apt_pkg, 'ParseDepends'):