aboutsummaryrefslogtreecommitdiff
path: root/python/dep_spec_TEST.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/dep_spec_TEST.py')
-rwxr-xr-xpython/dep_spec_TEST.py72
1 files changed, 40 insertions, 32 deletions
diff --git a/python/dep_spec_TEST.py b/python/dep_spec_TEST.py
index ac6a194eb..35051f6a5 100755
--- a/python/dep_spec_TEST.py
+++ b/python/dep_spec_TEST.py
@@ -68,38 +68,46 @@ class TestCase_1_DepSpecs(unittest.TestCase):
self.get_depspecs()
self.assertEquals(self.pds.version_requirements_mode, VersionRequirementsMode.AND)
-# def test_09_use_requirements(self):
-# spec = PortageDepParser.parse_depend("foo/monkey[foo]", PackageDepSpecParseMode.PERMISSIVE)
-# ur = iter(iter(spec).next().use_requirements).next()
-# self.assertEquals(str(ur[0]), "foo")
-# self.assertEquals(ur[1], UseFlagState.ENABLED)
-#
-# def test_10_composites(self):
-# spec = PortageDepParser.parse_depend("|| ( foo/bar foo/baz ) foo/monkey",
-# PackageDepSpecParseMode.PERMISSIVE)
-#
-# self.assert_(isinstance(spec, CompositeDepSpec))
-# self.assert_(isinstance(spec, AllDepSpec))
-#
-# self.assertEqual(len(list(spec)), 2)
-#
-# for i, subspec1 in enumerate(spec):
-# if i == 0:
-# self.assert_(isinstance(subspec1, AnyDepSpec))
-# for j, subspec2 in enumerate(subspec1):
-# if j == 0:
-# self.assert_(isinstance(subspec2, PackageDepSpec))
-# self.assertEquals(str(subspec2), "foo/bar")
-# elif j == 1:
-# self.assert_(isinstance(subspec2, PackageDepSpec))
-# self.assertEquals(str(subspec2), "foo/baz")
-# else:
-# self.assertEquals("Too many items", "OK")
-# elif i == 1:
-# self.assert_(isinstance(subspec1, PackageDepSpec))
-# self.assertEquals(str(subspec1), "foo/monkey")
-# else:
-# self.assertEquals("Too many items", "OK")
+ def test_09_use_requirements(self):
+ eapi = EAPIData.instance.eapi_from_string("paludis-1")
+ spec = PortageDepParser.parse_depend("foo/monkey[foo]", eapi)
+ ur = iter(iter(spec).next().use_requirements).next()
+ self.assertEquals(str(ur[0]), "foo")
+ self.assertEquals(ur[1], UseFlagState.ENABLED)
+
+ def test_10_without_use_requirements(self):
+ eapi = EAPIData.instance.eapi_from_string("paludis-1")
+ spec = PortageDepParser.parse_depend("foo/monkey[foo]", eapi)
+ pds = iter(spec).next().without_use_requirements()
+ self.assertEquals(pds.use_requirements, None)
+ self.assertEquals(str(pds), "foo/monkey")
+
+ def test_11_composites(self):
+ eapi = EAPIData.instance.eapi_from_string("0")
+ spec = PortageDepParser.parse_depend("|| ( foo/bar foo/baz ) foo/monkey", eapi)
+
+ self.assert_(isinstance(spec, CompositeDepSpec))
+ self.assert_(isinstance(spec, AllDepSpec))
+
+ self.assertEqual(len(list(spec)), 2)
+
+ for i, subspec1 in enumerate(spec):
+ if i == 0:
+ self.assert_(isinstance(subspec1, AnyDepSpec))
+ for j, subspec2 in enumerate(subspec1):
+ if j == 0:
+ self.assert_(isinstance(subspec2, PackageDepSpec))
+ self.assertEquals(str(subspec2), "foo/bar")
+ elif j == 1:
+ self.assert_(isinstance(subspec2, PackageDepSpec))
+ self.assertEquals(str(subspec2), "foo/baz")
+ else:
+ self.assertEquals("Too many items", "OK")
+ elif i == 1:
+ self.assert_(isinstance(subspec1, PackageDepSpec))
+ self.assertEquals(str(subspec1), "foo/monkey")
+ else:
+ self.assertEquals("Too many items", "OK")
if __name__ == "__main__":
unittest.main()