From 19e2e0f210da3fb4cb87cfe1ddd4bbc6c61d8cd1 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 26 May 2011 18:01:26 +0200 Subject: merge from debian, omit disable of the 0.7 API --- tests/test_group.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/test_group.py (limited to 'tests/test_group.py') diff --git a/tests/test_group.py b/tests/test_group.py new file mode 100644 index 00000000..3c3a5b7a --- /dev/null +++ b/tests/test_group.py @@ -0,0 +1,32 @@ +import unittest + +import apt_pkg + + +class TestGroup(unittest.TestCase): + + def setUp(self): + apt_pkg.init() + self.cache = apt_pkg.Cache(progress=None) + + 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) + + + def test_cache_groups(self): + """group: Iterate over all groups""" + assert len(list(self.cache.groups)) == self.cache.group_count + + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3