* support specification of output file in print method

* fix: print test to write to an external file
This commit is contained in:
Eray Özkural
2005-11-01 17:51:04 +00:00
parent 2d64b57349
commit 839e960059
2 changed files with 5 additions and 4 deletions
+2 -2
View File
@@ -298,8 +298,8 @@ class autoxml(oo.autosuper):
for formatter in self.__class__.formatters: for formatter in self.__class__.formatters:
formatter(self, f, errs) formatter(self, f, errs)
cls.format = format cls.format = format
def print_text(self): def print_text(self, file = sys.stdout):
w = Writer() # plain text w = Writer(file) # plain text
f = formatter.AbstractFormatter(w) f = formatter.AbstractFormatter(w)
errs = [] errs = []
self.format(f, errs) self.format(f, errs)
+3 -2
View File
@@ -67,8 +67,9 @@ class AutoXmlTestCase(testcase.TestCase):
self.assert_(not a.check()) self.assert_(not a.check())
a.print_text() a.print_text(file('/tmp/a', 'w'))
#self.assert_(string.startswith('Name')) la = file('/tmp/a').readlines()
self.assert_( util.any(lambda x:x.find('18071976')!=-1, la) )
a.write('/tmp/a.xml') a.write('/tmp/a.xml')
def testWriteRead(self): def testWriteRead(self):