aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2013-03-24 17:43:36 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2013-03-24 17:45:57 +0000
commit28f90203a55ffd1ac60540aa49601e8764fa9b08 (patch)
treee4ba7d1e837889522c7468fedc9c40900020aa26 /python
parent0e6261448e1613a45e4a3e79f7d9cf158e71df2d (diff)
downloadpaludis-28f90203a55ffd1ac60540aa49601e8764fa9b08.tar.gz
paludis-28f90203a55ffd1ac60540aa49601e8764fa9b08.tar.xz
Fix Python and Ruby for 0e62614 and .gitignore new test
Diffstat (limited to 'python')
-rw-r--r--python/contents.cc9
-rwxr-xr-xpython/contents_TEST.py12
2 files changed, 14 insertions, 7 deletions
diff --git a/python/contents.cc b/python/contents.cc
index a018aa40c..70594397f 100644
--- a/python/contents.cc
+++ b/python/contents.cc
@@ -80,8 +80,10 @@ void expose_contents()
(
"ContentsFileEntry",
"A file contents entry.",
- bp::init<const FSPath &>("__init__(location)")
- );
+ bp::init<const FSPath &, const std::string &>("__init__(location, part)")
+ )
+ .def("part_key", &ContentsFileEntry::part_key)
+ ;
/**
* ContentsDirEntry
@@ -110,12 +112,13 @@ void expose_contents()
(
"ContentsSymEntry",
"A sym contents entry.",
- bp::init<const FSPath &, const std::string &>("__init__(location, target_string)")
+ bp::init<const FSPath &, const std::string &, const std::string &>("__init__(location, target_string, part)")
)
.def("target_key", &ContentsSymEntry::target_key,
"The target_key, which will not be None, holds the symlink's target (as per readlink)."
)
+ .def("part_key", &ContentsSymEntry::part_key)
;
/**
diff --git a/python/contents_TEST.py b/python/contents_TEST.py
index 3e2c49bfb..03327b799 100755
--- a/python/contents_TEST.py
+++ b/python/contents_TEST.py
@@ -26,10 +26,11 @@ class TestCase_Contents(unittest.TestCase):
self.assertRaises(Exception, ContentsEntry)
def test_02_file_entry(self):
- e = ContentsFileEntry("/foo")
+ e = ContentsFileEntry("/foo", "bar")
self.assert_(isinstance(e, ContentsEntry))
self.assertEquals(e.location_key().parse_value(), "/foo")
+ self.assertEquals(e.part_key().parse_value(), "bar")
def test_03_dir_entry(self):
e = ContentsDirEntry("/foo")
@@ -44,16 +45,17 @@ class TestCase_Contents(unittest.TestCase):
self.assertEquals(e.location_key().parse_value(), "/foo")
def test_07_sym_entry(self):
- e = ContentsSymEntry("/foo", "/blah")
+ e = ContentsSymEntry("/foo", "/blah", "baz")
self.assert_(isinstance(e, ContentsEntry))
self.assertEquals(e.location_key().parse_value(), "/foo")
self.assertEquals(e.target_key().parse_value(), "/blah")
+ self.assertEquals(e.part_key().parse_value(), "baz")
def test_08_contents(self):
entries = []
- entries.append(ContentsSymEntry("/foo", "/blah"))
- entries.append(ContentsFileEntry("/foo"))
+ entries.append(ContentsSymEntry("/foo", "/blah", "x"))
+ entries.append(ContentsFileEntry("/foo", "x"))
entries.append(ContentsOtherEntry("/dev/foo"))
entries.append(ContentsDirEntry("/bar"))
@@ -66,6 +68,8 @@ class TestCase_Contents(unittest.TestCase):
self.assertEquals(type(entry), type(entries[i]))
if i==0:
self.assertEquals(entry.target_key().parse_value(), entries[i].target_key().parse_value())
+ if i==0 or i==1:
+ self.assertEquals(entry.part_key().parse_value(), entries[i].part_key().parse_value())
if i>3:
self.assertEquals("TOO MANY ENTRIES", "OK")