示例#1
0
 def testDuplicatedLetter(self):
     "A string with a duplicated modifier must be processed correctly."
     self.assertEqual((4, strToModifiers('=p'), None),
                      findModifiers("abs :=pp"))
示例#2
0
 def testEmpty(self):
     "Test an empty string."
     self.assertEqual((-1, Modifiers(), None), findModifiers(''))
示例#3
0
 def testDictWithModifiers(self):
     "A dict with modifiers must be processed correctly."
     self.assertEqual((24, strToModifiers('=p'), 17),
                      findModifiers("{'a':6, 'b':10, 'c':15} :=p17"))
示例#4
0
 def testDict(self):
     "A dict must not be confused for a string with modifiers."
     self.assertEqual((-1, Modifiers(), None),
                      findModifiers("{'a':6, 'b':10, 'c':15}"))
示例#5
0
 def testUnknownLetter(self):
     "Test a string with a non-modifier letter."
     # Before testing, make sure '?' is not actually a valid modifier.
     self.assertFalse('?' in MODIFIERS)
     self.assertEqual((-1, Modifiers(), None), findModifiers('4 :?'))
示例#6
0
 def testStringWithNoModifierSeparator(self):
     "Test a string with no modifier separator."
     self.assertEqual((-1, Modifiers(), None), findModifiers('hello'))
示例#7
0
 def testSeparatorIsLastLetter(self):
     "Test a string that ends with the separator."
     self.assertEqual((0, Modifiers(), None), findModifiers(':'))