File: test_cache_invocation.py

package info (click to toggle)
python-apt 0.7.100.1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,748 kB
  • ctags: 1,919
  • sloc: cpp: 8,937; python: 5,750; makefile: 89; sh: 9
file content (30 lines) | stat: -rw-r--r-- 897 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
#!/usr/bin/python
import unittest

import apt_pkg
import apt.progress.base


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

    def setUp(self):
        apt_pkg.init_config()
        apt_pkg.init_system()

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

        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(apt.progress.base.OpProgress())
        apt_depcache = apt_pkg.DepCache(apt_cache)

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