def checkPathForPattern(self, path, patterns, no_pattern=None): data = self._run_url(path) p = patterns_tester.checkStrings(data, patterns, no_pattern) msg = (p == no_pattern) and 'unexpected pattern found' or 'pattern missing' self.assert_(not p, u'failed:%s\n %s: %s%s' % (path, msg, p, patterns_tester.showFile(StringIO.StringIO(data), 'out', 10240), ))
def testDistillTxt(self): self.fp = rspreader.openlog(testpath / "plaintext.mlog") result = distillML.distillTxt(self.fp, self.buf, {}) self.assertEqual(0, result) # check content self.buf.seek(0) p = patterns_tester.checkStrings(self.buf.read(), ["Copyright", "All rights reserved.", "OF SUCH DAMAGE."]) self.assert_(not p, "unexpected: %s" % p)