From 4548cac388f26cec60f1cef028421db910385565 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 5 Apr 2011 14:37:16 +0200 Subject: Add apt_pkg.Group class, wrapping pkgCache::GrpIterator --- tests/test_group.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/test_group.py (limited to 'tests') diff --git a/tests/test_group.py b/tests/test_group.py new file mode 100644 index 00000000..b705d90e --- /dev/null +++ b/tests/test_group.py @@ -0,0 +1,27 @@ +import unittest + +import apt_pkg + + +class TestGroup(unittest.TestCase): + + def setUp(self): + apt_pkg.init() + self.cache = apt_pkg.Cache() + + def test_pkgingroup(self): + """Check that each package belongs to the corresponding group""" + for pkg in self.cache.packages: + group = apt_pkg.Group(self.cache, pkg.name) + assert any(pkg.id == p.id for p in group) + + def test_iteration(self): + """Check that iteration works correctly.""" + for pkg in self.cache.packages: + group = apt_pkg.Group(self.cache, pkg.name) + + list(group) == list(group) + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3