File: test_cache_invocation.py

package info (click to toggle)
python-apt 3.0.0
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 4,064 kB
  • sloc: cpp: 10,310; python: 8,803; makefile: 94; sh: 17
file content (31 lines) | stat: -rw-r--r-- 848 bytes parent folder | download
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
#!/usr/bin/python3
import unittest

import apt_pkg
import testcommon

import apt.progress.base


class TestCache(testcommon.TestCase):
    """Test invocation of apt_pkg.Cache()"""

    def test_wrong_invocation(self):
        """cache_invocation: Test wrong invocation."""
        apt_cache = apt_pkg.Cache(progress=None)

        self.assertRaises(ValueError, apt_pkg.Cache, apt_cache)
        self.assertRaises(
            ValueError, apt_pkg.Cache, apt.progress.base.AcquireProgress()
        )
        self.assertRaises(ValueError, apt_pkg.Cache, 0)

    def test_proper_invocation(self):
        """cache_invocation: Test correct invocation."""
        apt_cache = apt_pkg.Cache(progress=None)
        apt_depcache = apt_pkg.DepCache(apt_cache)
        self.assertNotEqual(apt_depcache, None)


if __name__ == "__main__":
    unittest.main()