diff options
| author | Julian Andres Klode <jak@debian.org> | 2011-04-05 14:37:16 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2011-04-05 14:37:16 +0200 |
| commit | 4548cac388f26cec60f1cef028421db910385565 (patch) | |
| tree | 6baf34bf0ac3cbc7e0737ff1ea0c3751b62332a5 /tests | |
| parent | f7adc2d7205e2fdbff7d808e8e4c262b65e3e05d (diff) | |
| download | python-apt-4548cac388f26cec60f1cef028421db910385565.tar.gz | |
Add apt_pkg.Group class, wrapping pkgCache::GrpIterator
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_group.py | 27 |
1 files changed, 27 insertions, 0 deletions
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() |
