示例#1
0
 def test_invalid_date_formats(self):
     self.assertFalse(
         LedgerThing.is_transaction_start('2013/5/12 abc store')
     )
     self.assertFalse(
         LedgerThing.is_transaction_start('2013/06/1 abc store')
     )
示例#2
0
 def test_transaction_code(self):
     self.assertTrue(
         LedgerThing.is_transaction_start('2016/10/20 (123) store')
     )
     self.assertTrue(
         LedgerThing.is_transaction_start('2016/10/20 (abc)store')
     )
     self.assertTrue(
         LedgerThing.is_transaction_start('2016/10/20 (123)')
     )
     self.assertTrue(
         LedgerThing.is_transaction_start('2016/10/20 (123)   ; xyz')
     )
     self.assertFalse(
         LedgerThing.is_transaction_start('2016/10/20(123)')
     )
     self.assertFalse(
         LedgerThing.is_transaction_start('2016/10/20someone')
     )
示例#3
0
 def test_whitespace(self):
     self.assertFalse(
         LedgerThing.is_transaction_start('            \t    ')
     )
示例#4
0
 def test_invalid_date(self):
     self.assertFalse(
         LedgerThing.is_transaction_start('2013/02/30 abc store')
     )
示例#5
0
 def test_newline(self):
     line = '\n'
     self.assertFalse(
         LedgerThing.is_transaction_start(line)
     )
示例#6
0
 def test_empty_line(self):
     self.assertFalse(LedgerThing.is_transaction_start(''))
示例#7
0
 def test_date_only(self):
     self.assertTrue(LedgerThing.is_transaction_start('2013/04/14 '))
     self.assertTrue(LedgerThing.is_transaction_start('2013/04/14'))
示例#8
0
 def test_leading_white_space(self):
     """leading whitespace should return false"""
     self.assertFalse(
         LedgerThing.is_transaction_start('    2013/04/14 abc store')
     )
示例#9
0
 def test_valid_transaction_start_with_tabs(self):
     """date recognized as the start of a transaction"""
     self.assertTrue(
         LedgerThing.is_transaction_start('2013/04/14\t\tabc store')
     )