Exemplo n.º 1
0
 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"))
Exemplo n.º 2
0
 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"))
Exemplo n.º 3
0
    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))
Exemplo n.º 4
0
    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))
Exemplo n.º 5
0
def itr(text_en,**kw):
    for v in kw.values():
        assert ispure(v)
    _messages[text_en] = kw
Exemplo n.º 6
0
 def validate(self, value):
     AsciiType.validate(self, value)
     if not ispure(value):
         raise DataVeto("%r is not pure" % value)
Exemplo n.º 7
0
 def validate(self,value):
     AsciiType.validate(self,value)
     if not ispure(value):
         raise DataVeto("%r is not pure" % value)
Exemplo n.º 8
0
 def format(self, v):
     s = self.datatype.format(v)
     assert ispure(s), "%r : %r: not pure" % (self, s)
     return s
Exemplo n.º 9
0
 def format(self,v):
     s=self.datatype.format(v)
     assert ispure(s), "%r : %r: not pure" % (self,s)
     return s