>>> from deutes import classifica_saldos >>> text1 = '''Alfa:1800:800 ... Beta:400:400 ... Gamma:900:100 ... Delta:500:100 ... Epsilon:300:500 ... ''' >>> with open('factures1.txt', 'w') as f: ... n = f.write(text1) >>> dlimits = { ... "Alfa": 1000, "Beta": 500, "Gamma": 750, ... "Delta": 300, "Epsilon": 200} >>> classifica_saldos('factures1.txt',dlimits,'fok1.txt','fdeu1.txt') >>> with open('fok1.txt','r') as f: ... s1a = f.read() >>> s1a == 'Alfa:1000:1000\nBeta:0:500\nEpsilon:0:200\n' True >>> with open('fdeu1.txt','r') as f: ... s1b = f.read() >>> s1b == 'Gamma:800:750\nDelta:400:300\n' True >>> dlimits2 = { ... "Alfa": 1000, "Beta": 500, "Gamma": 750, "Delta": 300, ... "Epsilon": 200, "Zeta": 300, "Eta": 600, "Theta": 100, ... "Iota": 0, "Kappa": 1500, "Lambda": 1200, "Mu": 10} >>> text2 = '''Alfa:1800:800 ... Beta:400:400 ... Gamma:900:100 ... Delta:500:100 ... Epsilon:300:500 ... Zeta:1200:900 ... Eta:750:100 ... Theta:100:50 ... Iota:0:0 ... Kappa:2500:1000 ... Lambda:2000:400 ... Mu:1000:999 ... ''' >>> with open('factures2.txt', 'w') as f: ... n = f.write(text2) >>> classifica_saldos('factures2.txt', dlimits2, 'fok2.txt', 'fdeu2.txt') >>> with open('fok2.txt', 'r') as f: ... s2a = f.read() >>> s2a == 'Alfa:1000:1000\nBeta:0:500\nEpsilon:0:200\nZeta:300:300\nTheta:50:100\nIota:0:0\nKappa:1500:1500\nMu:1:10\n' True >>> with open('fdeu2.txt', 'r') as f: ... s2b = f.read() >>> s2b == 'Gamma:800:750\nDelta:400:300\nEta:650:600\nLambda:1600:1200\n' True