* support specification of output file in print method
* fix: print test to write to an external file
This commit is contained in:
+2
-2
@@ -298,8 +298,8 @@ class autoxml(oo.autosuper):
|
||||
for formatter in self.__class__.formatters:
|
||||
formatter(self, f, errs)
|
||||
cls.format = format
|
||||
def print_text(self):
|
||||
w = Writer() # plain text
|
||||
def print_text(self, file = sys.stdout):
|
||||
w = Writer(file) # plain text
|
||||
f = formatter.AbstractFormatter(w)
|
||||
errs = []
|
||||
self.format(f, errs)
|
||||
|
||||
@@ -67,8 +67,9 @@ class AutoXmlTestCase(testcase.TestCase):
|
||||
|
||||
self.assert_(not a.check())
|
||||
|
||||
a.print_text()
|
||||
#self.assert_(string.startswith('Name'))
|
||||
a.print_text(file('/tmp/a', 'w'))
|
||||
la = file('/tmp/a').readlines()
|
||||
self.assert_( util.any(lambda x:x.find('18071976')!=-1, la) )
|
||||
a.write('/tmp/a.xml')
|
||||
|
||||
def testWriteRead(self):
|
||||
|
||||
Reference in New Issue
Block a user