diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-10-05 10:32:04 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-10-05 10:32:04 +0200 |
| commit | f17fc818cca41668bb6358e490ff3278e64fa493 (patch) | |
| tree | 0ee5c2b599b22a82e7247df291f8f7c95eb03dca /tests/test_apt_cache.py | |
| parent | a2363f7e30c93599af6366413bad965846a12d83 (diff) | |
| download | python-apt-f17fc818cca41668bb6358e490ff3278e64fa493.tar.gz | |
* tests/test_apt_cache.py:
- add __cmp__ to apt.Package so that sort() sorts by name
on list of package objects
Diffstat (limited to 'tests/test_apt_cache.py')
| -rw-r--r-- | tests/test_apt_cache.py | 11 |
1 files changed, 11 insertions, 0 deletions
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() |
