>>> from construccio import retards >>> s = "xy_98967;NO INICIADA;23000;12;04/24\nWT_87563;EN CURS;12500;3;08/23\nATRP_785;NO INICIADA;245000;23;08/24\nxyT_12967;ACABADA;20000;6;04/23\nWTMN_563;EN CURS;12500;3;02/24\nLLRTP_85;NO INICIADA;245000;23;08/24\nBAxy_98967;NO INICIADA;600000;20;12/24\nWEST_87563;EN CURS;12500;3;08/23\nRAZTP_785;NO INICIADA;245000;23;08/24\nALMxy_98967;NO INICIADA;23000;10;12/23\nCAWT_87563;ACABADA;5500;5;12/23\nTDRTP_785;NO INICIADA;245000;33;08/26" >>> with open('construcSA.txt', 'w') as f: ... n = f.write(s) ---- inici >>> r = retards('construcSA.txt', '05/23') >>> r [('xy_98967', 11, 12), ('ATRP_785', 15, 23), ('LLRTP_85', 15, 23), ('BAxy_98967', 19, 20), ('RAZTP_785', 15, 23), ('ALMxy_98967', 7, 10)] >>> r = retards('construcSA.txt', '10/23') >>> r [('xy_98967', 6, 12), ('ATRP_785', 10, 23), ('LLRTP_85', 10, 23), ('BAxy_98967', 14, 20), ('RAZTP_785', 10, 23), ('ALMxy_98967', 2, 10)] >>> r = retards('construcSA.txt', '01/24') >>> r [('xy_98967', 3, 12), ('ATRP_785', 7, 23), ('LLRTP_85', 7, 23), ('BAxy_98967', 11, 20), ('RAZTP_785', 7, 23), ('ALMxy_98967', -1, 10), ('TDRTP_785', 31, 33)] >>> r = retards('construcSA.txt', '01/23') >>> r [('ATRP_785', 19, 23), ('LLRTP_85', 19, 23), ('RAZTP_785', 19, 23)] ---- fi Joc de proves 2: cap obra iniciada >>> s = """\ ... WT_87563;NO INICIADA;12500;3;05/23 ... xyT_12967;NO INICIADA;20000;6;04/23 ... WTMN_563;NO INICIADA;12500;3;02/24 ... WEST_87563;NO INICIADA;12500;3;08/23 ... CAWT_87563;NO INICIADA;5500;5;12/23 ... """ >>> with open('construcSA-2.txt', 'w') as f: ... n = f.write(s) >>> r = retards('construcSA-2.txt', '09/22') >>> r [] >>> r = retards('construcSA-2.txt', '10/22') >>> r [('xyT_12967', 6, 6)] >>> r = retards('construcSA-2.txt', '11/22') >>> r [('xyT_12967', 5, 6)] >>> r = retards('construcSA-2.txt', '04/23') >>> r [('WT_87563', 1, 3), ('xyT_12967', 0, 6)] Joc de proves 3: no hi ha obres no iniciades >>> s = """\ ... WT_87563;EN CURS;12500;3;08/23 ... xyT_12967;ACABADA;20000;6;04/23 ... WTMN_563;EN CURS;12500;3;02/24 ... WEST_87563;EN CURS;12500;3;08/23 ... CAWT_87563;ACABADA;5500;5;12/23 ... """ >>> with open('construcSA-3.txt', 'w') as f: ... n = f.write(s) >>> r = retards('construcSA-3.txt', '05/23') >>> r [] >>> r = retards('construcSA-3.txt', '10/23') >>> r [] Joc de proves 4: fitxer buit >>> s = """\ ... """ >>> with open('construcSA-4.txt', 'w') as f: ... n = f.write(s) >>> r = retards('construcSA-4.txt', '05/23') >>> r [] >>> r = retards('construcSA-4.txt', '10/23') >>> r []