def test01(self): s=u"Komm sing uns mal ein schönes Lied" tokens=standardTokenizer(s) #print repr(s) #print [t for t in tokens] for t in tokens: assert ispure(t) #print ispure("schön") self.failIf(ispure("schön"))
def trycmd(self,cmd, expected=None, msg=None, startdir=None, expectfile=None): observed,exitstatus=trycmd(cmd,startdir=startdir) #print "observed", observed #msg=repr(cmd)+" failed" if exitstatus is not None: self.fail( "%r failed: close() returned %r, stdout is %r." \ % (cmd,exitstatus,observed)) if expected is not None: assert ispure(expected) expected=expected.strip() if msg is None: msg="unexpected output of `%s`" % cmd self.assertEquivalent(observed.strip(),expected,msg) if expectfile is not None: self._tempFiles.remove(expectfile) if not os.path.exists(expectfile): self.fail( '`%s` did not generate file %s. Output is:\n%s'\ % (cmd,expectfile,observed))
def trycmd(self, cmd, expected=None, msg=None, startdir=None, expectfile=None): observed, exitstatus = trycmd(cmd, startdir=startdir) #print "observed", observed #msg=repr(cmd)+" failed" if exitstatus is not None: self.fail( "%r failed: close() returned %r, stdout is %r." \ % (cmd,exitstatus,observed)) if expected is not None: assert ispure(expected) expected = expected.strip() if msg is None: msg = "unexpected output of `%s`" % cmd self.assertEquivalent(observed.strip(), expected, msg) if expectfile is not None: self._tempFiles.remove(expectfile) if not os.path.exists(expectfile): self.fail( '`%s` did not generate file %s. Output is:\n%s'\ % (cmd,expectfile,observed))
def itr(text_en,**kw): for v in kw.values(): assert ispure(v) _messages[text_en] = kw
def validate(self, value): AsciiType.validate(self, value) if not ispure(value): raise DataVeto("%r is not pure" % value)
def validate(self,value): AsciiType.validate(self,value) if not ispure(value): raise DataVeto("%r is not pure" % value)
def format(self, v): s = self.datatype.format(v) assert ispure(s), "%r : %r: not pure" % (self, s) return s
def format(self,v): s=self.datatype.format(v) assert ispure(s), "%r : %r: not pure" % (self,s) return s