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') )
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') )
def test_whitespace(self): self.assertFalse( LedgerThing.is_transaction_start(' \t ') )
def test_invalid_date(self): self.assertFalse( LedgerThing.is_transaction_start('2013/02/30 abc store') )
def test_newline(self): line = '\n' self.assertFalse( LedgerThing.is_transaction_start(line) )
def test_empty_line(self): self.assertFalse(LedgerThing.is_transaction_start(''))
def test_date_only(self): self.assertTrue(LedgerThing.is_transaction_start('2013/04/14 ')) self.assertTrue(LedgerThing.is_transaction_start('2013/04/14'))
def test_leading_white_space(self): """leading whitespace should return false""" self.assertFalse( LedgerThing.is_transaction_start(' 2013/04/14 abc store') )
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') )