+++ /dev/null
-import unittest
-from test import test_support
-
-from gentoolkit import equery
-
-class TestEqueryInit(unittest.TestCase):
-
- def setUp(self):
- pass
-
- def tearDown(self):
- pass
-
- def test_expand_module_name(self):
- # Test that module names are properly expanded
- name_map = {
- 'b': 'belongs',
- 'c': 'changes',
- 'k': 'check',
- 'd': 'depends',
- 'g': 'depgraph',
- 'f': 'files',
- 'h': 'hasuse',
- 'l': 'list_',
- 'm': 'meta',
- 's': 'size',
- 'u': 'uses',
- 'w': 'which'
- }
- for short_name, long_name in zip(name_map, name_map.values()):
- self.failUnlessEqual(equery.expand_module_name(short_name),
- long_name)
- self.failUnlessEqual(equery.expand_module_name(long_name),
- long_name)
- unused_keys = set(map(chr, range(0, 256))).difference(name_map.keys())
- for key in unused_keys:
- self.failUnlessRaises(KeyError, equery.expand_module_name, key)
-
-def test_main():
- test_support.run_unittest(TestEqueryInit)
-
-if __name__ == '__main__':
- test_main()
+++ /dev/null
-import unittest
-from test import test_support
-
-from gentoolkit import helpers2
-
-class TestGentoolkitHelpers2(unittest.TestCase):
-
- def test_compare_package_strings(self):
- # Test ordering of package strings, Portage has test for vercmp,
- # so just do the rest
- version_tests = [
- # different categories
- ('sys-apps/portage-2.1.6.8', 'sys-auth/pambase-20080318'),
- # different package names
- ('sys-apps/pkgcore-0.4.7.15-r1', 'sys-apps/portage-2.1.6.8'),
- # different package versions
- ('sys-apps/portage-2.1.6.8', 'sys-apps/portage-2.2_rc25')
- ]
- # Check less than
- for vt in version_tests:
- self.failUnless(
- helpers2.compare_package_strings(vt[0], vt[1]) == -1
- )
- # Check greater than
- for vt in version_tests:
- self.failUnless(
- helpers2.compare_package_strings(vt[1], vt[0]) == 1
- )
- # Check equal
- vt = ('sys-auth/pambase-20080318', 'sys-auth/pambase-20080318')
- self.failUnless(
- helpers2.compare_package_strings(vt[0], vt[1]) == 0
- )
-
-def test_main():
- test_support.run_unittest(TestGentoolkitHelpers2)
-
-if __name__ == '__main__':
- test_main()
+++ /dev/null
-import unittest
-from test import test_support
-
-class MyTestCase1(unittest.TestCase):
-
- # Only use setUp() and tearDown() if necessary
-
- def setUp(self):
- ... code to execute in preparation for tests ...
-
- def tearDown(self):
- ... code to execute to clean up after tests ...
-
- def test_feature_one(self):
- # Test feature one.
- ... testing code ...
-
- def test_feature_two(self):
- # Test feature two.
- ... testing code ...
-
- ... more test methods ...
-
-class MyTestCase2(unittest.TestCase):
- ... same structure as MyTestCase1 ...
-
-... more test classes ...
-
-def test_main():
- test_support.run_unittest(
- MyTestCase1,
- MyTestCase2,
- ... list other tests ...
- )
-
-if __name__ == '__main__':
- test_main()
-