summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt/package.py2
-rw-r--r--tests/test_deps.py28
2 files changed, 29 insertions, 1 deletions
diff --git a/apt/package.py b/apt/package.py
index 78b10af4..5d122968 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -78,7 +78,7 @@ class BaseDependency(object):
return str.__eq__(self, other) or str.__eq__(2 * self, other)
def __ne__(self, other):
- return str.__eq__(self, other) and str.__ne__(2 * self, other)
+ return not self.__eq__(other)
def __init__(self, name, rel, ver, pre, rawtype=None):
self.name = name
diff --git a/tests/test_deps.py b/tests/test_deps.py
index e9a75ee2..399bb9ba 100644
--- a/tests/test_deps.py
+++ b/tests/test_deps.py
@@ -9,6 +9,7 @@
import unittest
import apt_pkg
+import apt.package
class TestDependencies(unittest.TestCase):
@@ -110,6 +111,33 @@ 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
+ self.assertEqual(dstr("<"), "<<")
+ self.assertEqual(dstr("<"), "<")
+ self.assertEqual("<<", dstr("<"))
+ self.assertEqual("<", dstr("<"))
+ self.assertEqual(dstr(">"), ">>")
+ self.assertEqual(dstr(">"), ">")
+ self.assertEqual(">>", dstr(">"))
+ self.assertEqual(">", dstr(">"))
+ self.assertNotEqual(dstr(">"), "<")
+ self.assertNotEqual(dstr(">"), "<=")
+ self.assertNotEqual(dstr(">"), "<<")
+ self.assertNotEqual(dstr(">"), "!=")
+ self.assertNotEqual(dstr(">"), "=")
+ self.assertNotEqual(dstr(">"), "<")
+ self.assertNotEqual(dstr(">"), "<=")
+ self.assertNotEqual(dstr(">"), "<<")
+ self.assertNotEqual(dstr(">"), "!=")
+ self.assertNotEqual(dstr(">"), "=")
+ self.assertFalse(dstr("<") != "<")
+ self.assertFalse(dstr("<") != "<<")
+ self.assertFalse(dstr(">") != ">")
+ self.assertFalse(dstr(">") != ">>")
+
+
def testParseDepends(self):
"""dependencies: Test apt_pkg.ParseDepends()."""
if not hasattr(apt_pkg, 'ParseDepends'):