1212class TestStatement (unittest .TestCase ):
1313
1414 def test_render_parse_cfonb (self ):
15- content = Statement ().header ('20002' , '90005' , 'EUR' , '01711467640 ' , date (2011 , 10 , 14 ), 12345.67 )\
16- .add ('20002' , '1234567' , '90005' , 'EUR' , '01711467640 ' , date (2011 , 10 , 14 ), 'label 1' , 1234.56 , 'reference1' )\
17- .add ('20002' , '1234567' , '90005' , 'EUR' , '01711467640 ' , date (2011 , 10 , 13 ), 'label 2' , 123.45 , 'reference2' )\
15+ content = Statement ().header ('20002' , '90005' , 'EUR' , '01717651230 ' , date (2011 , 10 , 14 ), 12345.67 )\
16+ .add ('20002' , '1234567' , '90005' , 'EUR' , '01717651230 ' , date (2011 , 10 , 14 ), 'label 1' , 1234.56 , 'reference1' )\
17+ .add ('20002' , '1234567' , '90005' , 'EUR' , '01717651230 ' , date (2011 , 10 , 13 ), 'label 2' , 123.45 , 'reference2' )\
1818 .render ()
1919 print ('content: {}' .format (content ))
2020 reader = StatementReader ()
2121 result = reader .parse (StringIO (content ))
2222 for account in result :
2323 assert_is_not_none (account .account_nb )
24- assert_equal (account .header .get ('account_nb' ), '01711467640 ' )
24+ assert_equal (account .header .get ('account_nb' ), '01717651230 ' )
2525 assert_equal (account .header .get ('currency_code' ), 'EUR' )
2626 assert_equal (account .header .get ('nb_of_dec' ), '2' )
2727 assert_equal (account .header .get ('bank_code' ), '20002' )
@@ -36,35 +36,19 @@ def test_number_format(self):
3636 assert_equal (number_format ('' ), '' )
3737
3838 def test_parse_with_original_content (self ):
39- content = '''0115589 29701EUR2 01711467640 220620GAEC DE STANG KERBAIL 0000000352431O0000
40- 0415589 29701EUR2E01711467640B1230620 220620PRLV ORANGE 0 0000000000315}VOTRE ABONNEMENT
41- 0515589 29701EUR2E01711467640B1230620 NBEORANGE
42- 0515589 29701EUR2E01711467640B1230620 LCCVOTRE ABONNEMENT FIXE 02XXXXX896 (FACTURE: XXXXX8960E2) - P
43- 0515589 29701EUR2E01711467640B1230620 RCN298576896 985768960E235E
44- 0515589 29701EUR2E01711467640B1230620 LIBPRELEVEMENTS SEPA DOMICILIES
45- 0715589 29701EUR2 01711467640 230620 0000000352746O '''
39+ content = '''0115589 29701EUR2 01717651230 220620AAAA BB CCCCC KERHHHH 0000000352431O0000
40+ 0415589 29701EUR2E01717651230B1230620 220620PRLV AAAAAA 0 0000000000315}VOTRE ABONNEMENT
41+ 0515589 29701EUR2E01717651230B1230620 YYYXXXXXX
42+ 0515589 29701EUR2E01717651230B1230620 LCCVOTRE ABONNEMENT FIXE 02XXXXX896 (FACTURE: XXXXX8960E2) - P
43+ 0515589 29701EUR2E01717651230B1230620 ABC683551768 777888999E111E
44+ 0515589 29701EUR2E01717651230B1230620 LIBPRELEVEMENTS SEPA DOMICILIES
45+ 0715589 29701EUR2 01717651230 230620 0000000352746O '''
4646 reader = StatementReader ()
4747 result = reader .parse (StringIO (content ))
4848 assert_equal (len (result [0 ].lines ), 1 )
49- assert_true (result [0 ].lines [0 ].get ('origin' ).startswith ('0415589 29701EUR2E01711467640B1230620 220620PRLV ORANGE 0 0000000000315}VOTRE ABONNEMENT' ))
50- assert_true (result [0 ].lines [0 ].get ('origin' ).endswith ('0515589 29701EUR2E01711467640B1230620 LIBPRELEVEMENTS SEPA DOMICILIES ' ))
49+ assert_true (result [0 ].lines [0 ].get ('origin' ).startswith ('0415589 29701EUR2E01717651230B1230620 220620PRLV AAAAAA 0 0000000000315}VOTRE ABONNEMENT' ))
50+ assert_true (result [0 ].lines [0 ].get ('origin' ).endswith ('0515589 29701EUR2E01717651230B1230620 LIBPRELEVEMENTS SEPA DOMICILIES ' ))
5151 assert_true (len (result [0 ].lines [0 ].get ('origin' ).splitlines ()) == 5 )
52-
53- def test_parse_with_comment_content (self ):
54- content = '''0115589 29701EUR2 01711467640 220620GAEC DE STANG KERBAIL 0000000352431O0000
55- 0415589 29701EUR2E01711467640B1230620 220620PRLV ORANGE 0 0000000000315}VOTRE ABONNEMENT
56- 0515589 29701EUR2E01711467640B1230620 NBEORANGE
57- 0515589 29701EUR2E01711467640B1230620 LCCVOTRE ABONNEMENT FIXE 02XXXXX896 (FACTURE: XXXXX8960E2) - P
58- 0515589 29701EUR2E01711467640B1230620 RCN298576896 985768960E235E
59- 0515589 29701EUR2E01711467640B1230620 LIBPRELEVEMENTS SEPA DOMICILIES
60- 0715589 29701EUR2 01711467640 230620 0000000352746O '''
61- reader = StatementReader ()
62- result = reader .parse (StringIO (content ))
63- assert_equal (len (result [0 ].lines ), 1 )
64- assert_true (result [0 ].lines [0 ].get ('comment' ).startswith (
65- 'NBEORANGE' ))
66- assert_true (result [0 ].lines [0 ].get ('comment' ).endswith (
67- 'LIBPRELEVEMENTS SEPA DOMICILIES' ))
6852 assert_true (len (result [0 ].lines [0 ].get ('comment' ).splitlines ()) == 4 )
6953
7054
0 commit comments