File: test_group.py

package info (click to toggle)
python-apt 1.4.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,980 kB
  • sloc: cpp: 10,003; python: 7,108; makefile: 107; sh: 27
file content (33 lines) | stat: -rw-r--r-- 875 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import unittest

import apt_pkg

import testcommon


class TestGroup(testcommon.TestCase):

    def setUp(self):
        testcommon.TestCase.setUp(self)
        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()