File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -45,10 +45,13 @@ def parse(self, file_obj):
4545 while True :
4646 index += 1
4747 if not row .get ('label_%s' % index ):
48- row ['label_%s' % index ] = new_row .label
48+ row ['label_%s' % index ] = new_row .get ( ' label' )
4949 break
5050 else :
5151 row .update (new_row )
52+ comment = line .split (' ' )[2 ].strip ()
53+ if comment :
54+ row ['comment' ] = row .get ('comment' , '' ) + (BR_LINE if row .get ('comment' , '' ) else '' ) + comment
5255 elif line [0 :2 ] == '07' :
5356 statement .footer = Row (line )
5457 else :
Original file line number Diff line number Diff line change @@ -50,6 +50,23 @@ def test_parse_with_original_content(self):
5050 assert_true (result [0 ].lines [0 ].get ('origin' ).endswith ('0515589 29701EUR2E01711467640B1230620 LIBPRELEVEMENTS SEPA DOMICILIES ' ))
5151 assert_true (len (result [0 ].lines [0 ].get ('origin' ).splitlines ()) == 5 )
5252
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' ))
68+ assert_true (len (result [0 ].lines [0 ].get ('comment' ).splitlines ()) == 4 )
69+
5370
5471def suite ():
5572 suite = unittest .TestSuite ()
You can’t perform that action at this time.
0 commit comments