diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-06-29 11:02:42 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-06-29 11:02:42 +0200 |
| commit | cdaebccd5f7a5a0e23a9be7989b64850fabafed1 (patch) | |
| tree | 52d3bd94c02ae9be75fb11bfd423043ef10838cc /tests | |
| parent | 57624b5df523c0b3a3ebc1741680f283ee1fbbcd (diff) | |
| parent | 340f6a3d54f5705801267f365fb08b5d20228fe6 (diff) | |
| download | python-apt-cdaebccd5f7a5a0e23a9be7989b64850fabafed1.tar.gz | |
merged from debian-sid
Diffstat (limited to 'tests')
| -rw-r--r--[-rwxr-xr-x] | tests/old/memleak.py | 0 | ||||
| -rw-r--r-- | tests/test_apt_cache.py | 19 |
2 files changed, 14 insertions, 5 deletions
diff --git a/tests/old/memleak.py b/tests/old/memleak.py index 5299f35f..5299f35f 100755..100644 --- a/tests/old/memleak.py +++ b/tests/old/memleak.py diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index 3c2961e1..a00fa08b 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -15,9 +15,9 @@ class TestAptCache(unittest.TestCase): """ test the apt cache """ def testAptCache(self): - """ simple test that iterates all packages and all dependencies """ + """cache: iterate all packages and all dependencies """ cache = apt.Cache() - # number is not meaningful and just need to be "big enough", + # number is not meaningful and just need to be "big enough", # the important bit is the test against __len__ self.assertTrue(len(cache) > 100) # go over the cache and all dependencies, just to see if @@ -26,9 +26,18 @@ class TestAptCache(unittest.TestCase): if pkg.candidate: for or_dep in pkg.candidate.dependencies: for dep in or_dep.or_dependencies: - name = dep.name - relation = dep.relation - preDepends = dep.pre_depend + self.assertTrue(dep.name) + self.assertTrue(isinstance(dep.relation, str)) + self.assertTrue(dep.pre_depend in (True, False)) + + # accessing record should take a reasonable time; in + # particular, when using compressed indexes, it should not use + # tons of seek operations + r = pkg.candidate.record + self.assertEqual(r['Package'], pkg.name) + self.assert_('Version' in r) + self.assert_(len(r['Description']) > 0) + self.assert_(str(r).startswith('Package: %s\n' % pkg.name)) if __name__ == "__main__": unittest.main() |
