Conditions | 1 |
Total Lines | 72 |
Code Lines | 56 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | import inspect |
||
73 | def test_arrendamiento_de_inmuebles(): |
||
74 | ari_file = os.path.join(current_dir, 'pdl', 'ejemplo_ari.xml') |
||
75 | report_f = CFDI.from_file(ari_file) |
||
76 | |||
77 | report_a = ari.Archivo( |
||
78 | informe=ari.InformeType( |
||
79 | mes_reportado='201407', |
||
80 | sujeto_obligado=ari.SujetoObligadoType( |
||
81 | clave_sujeto_obligado='OGA751212G56', |
||
82 | clave_actividad='ARI' |
||
83 | ), |
||
84 | aviso=ari.AvisoType( |
||
85 | referencia_aviso='REF15454FG454', |
||
86 | prioridad='1', |
||
87 | alerta=ari.AlertaType( |
||
88 | tipo_alerta='100' |
||
89 | ), |
||
90 | persona_aviso=ari.PersonaAvisoType( |
||
91 | tipo_persona=ari.TipoPersonaType( |
||
92 | persona_fisica=ari.PersonaFisicaType( |
||
93 | nombre='NEPOMUCENO', |
||
94 | apellido_paterno='ALMONTE', |
||
95 | apellido_materno='JUAREZ', |
||
96 | fecha_nacimiento=date(1956, 8, 16), |
||
97 | pais_nacionalidad='TG', |
||
98 | actividad_economica='3130100' |
||
99 | ) |
||
100 | ), |
||
101 | tipo_domicilio=ari.TipoDomicilioType( |
||
102 | extranjero=ari.ExtranjeroType( |
||
103 | pais='TG', |
||
104 | estado_provincia='TOGUILLITA', |
||
105 | ciudad_poblacion='TOGUIS', |
||
106 | colonia='NA', |
||
107 | calle='TOGA TOGA', |
||
108 | numero_exterior='45', |
||
109 | codigo_postal='12448' |
||
110 | ) |
||
111 | ), |
||
112 | ), |
||
113 | detalle_operaciones=ari.DetalleOperacionesType( |
||
114 | datos_operacion=ari.DatosOperacionType( |
||
115 | fecha_operacion=date(2014, 7, 1), |
||
116 | tipo_operacion='1501', |
||
117 | caracteristicas=ari.CaracteristicasType( |
||
118 | fecha_inicio=date(2014, 1, 1), |
||
119 | fecha_termino=date(2015, 1, 1), |
||
120 | tipo_inmueble='3', |
||
121 | valor_referencia='356825.12', |
||
122 | colonia='6920', |
||
123 | calle='SAN SIMON TOLNAHUAC', |
||
124 | numero_exterior='VIOLANTE', |
||
125 | numero_interior='45', |
||
126 | codigo_postal='01058', |
||
127 | folio_real='BG544-FRR-456B-FRR' |
||
128 | ), |
||
129 | datos_liquidacion=ari.DatosLiquidacionType( |
||
130 | fecha_pago=date(2014, 7, 1), |
||
131 | forma_pago='4', |
||
132 | instrumento_monetario='4', |
||
133 | moneda='2', |
||
134 | monto_operacion='757897.55' |
||
135 | ) |
||
136 | ) |
||
137 | ) |
||
138 | ) |
||
139 | ) |
||
140 | ).process() |
||
141 | |||
142 | assert report_a == report_f |
||
143 | |||
144 | verify_invoice(report_a, path=f"o_{inspect.stack()[0][3]}") |
||
145 |