forked from yahuarkuntur/gdimm2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_tests.py
67 lines (45 loc) · 1.33 KB
/
run_tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python
import os
from lxml import etree
from calc import Calculator
from val import Validator
from data import *
from ref_data import RefData
parser = etree.XMLParser(remove_comments=True, encoding='utf8')
xml = etree.parse(os.path.join('tests','104ORI_MAR2011.xml'), parser)
def test_calcs(version):
print 'Prueba de calculos:'
calcs = Calculator()
calcs.load_xml(version)
calcs.load_xsl('calculos.xsl')
calcs.calc(xml)
for x in calcs.get_calculations():
print x
print 'Listo'
def test_vals(version):
print 'Prueba de validaciones:'
valid = Validator()
valid.load_xml(version)
valid.load_xsl('validaciones.xsl')
valid.validate(xml)
for x in valid.get_validations():
print x
print 'Listo'
def test_xml_file_load():
print 'Prueba de carga:'
ref_data = RefData()
lstContribuyentes = ListaContribuyentes()
lstContribuyentes.load()
declaracion = Declaracion()
try:
declaracion = declaracion.cargar_declaracion_guardada(xml, lstContribuyentes, ref_data)
print 'Listo'
except Exception as ex:
print str(ex)
return
test_calcs(declaracion.get_version())
test_vals(declaracion.get_version())
def run_tests():
test_xml_file_load()
if __name__ == '__main__':
run_tests()