[py-svn] r37226 - in py/dist/py/rest: . testing
cfbolz at codespeak.net
cfbolz at codespeak.net
Tue Jan 23 19:36:06 CET 2007
Author: cfbolz
Date: Tue Jan 23 19:36:04 2007
New Revision: 37226
Modified:
py/dist/py/rest/rst.py
py/dist/py/rest/testing/test_rst.py
Log:
make AbstractNode.join take *args
Modified: py/dist/py/rest/rst.py
==============================================================================
--- py/dist/py/rest/rst.py (original)
+++ py/dist/py/rest/rst.py Tue Jan 23 19:36:04 2007
@@ -65,12 +65,13 @@
for arg in kwargs:
setattr(self, arg, kwargs[arg])
- def join(self, child):
- """ adds a child node
+ def join(self, *children):
+ """ add child nodes
returns a reference to self
"""
- self._add(child)
+ for child in children:
+ self._add(child)
return self
def add(self, child):
@@ -78,7 +79,6 @@
returns a reference to the child
"""
- self._add(child)
return child
def _add(self, child):
Modified: py/dist/py/rest/testing/test_rst.py
==============================================================================
--- py/dist/py/rest/testing/test_rst.py (original)
+++ py/dist/py/rest/testing/test_rst.py Tue Jan 23 19:36:04 2007
@@ -92,6 +92,11 @@
txt = Paragraph(Text("dupa"), Text("dupa")).text()
assert txt == "dupa dupa"
+def test_text_join():
+ txt = Paragraph(Text("worse things"))
+ txt = txt.join(Text("happen at sea"), Text("you know"))
+ assert txt.text() == "worse things happen at sea you know"
+
def test_paragraph_basic():
txt = Paragraph(Text('spam')).text()
assert txt == 'spam'
More information about the pytest-commit
mailing list