From f17fc818cca41668bb6358e490ff3278e64fa493 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 5 Oct 2011 10:32:04 +0200 Subject: * tests/test_apt_cache.py: - add __cmp__ to apt.Package so that sort() sorts by name on list of package objects --- tests/test_apt_cache.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/test_apt_cache.py') diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index 2f812059..9c1f549f 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -181,5 +181,16 @@ class TestAptCache(unittest.TestCase): apt_pkg.config.set("dir::etc::sourcelist", old_source_list) apt_pkg.config.set("dir::etc::sourceparts", old_source_parts) + def test_package_cmp(self): + cache = apt.Cache() + l = [] + l.append(cache["libc6"]) + l.append(cache["xterm"]) + l.append(cache["apt"]) + l.sort() + self.assertEqual([p.name for p in l], + ["apt", "libc6", "xterm"]) + + if __name__ == "__main__": unittest.main() -- cgit v1.2.3