@@ -208,10 +208,98 @@ def test_cst000_ibscbs_tributacao_integral(self):
208208 is_tag = xml .xpath ("//ns:det/ns:imposto/ns:IS" , namespaces = self .ns )
209209 self .assertEqual (len (is_tag ), 0 )
210210
211+ # No gRed anywhere (CST 000 is not in IBSCBS_CST_GRUPO_REDUCAO)
212+ gred = xml .xpath ("//ns:IBSCBS/ns:gIBSCBS//ns:gRed" , namespaces = self .ns )
213+ self .assertEqual (len (gred ), 0 )
214+
215+ # ------------------------------------------------------------------
216+ # Test 1b: CST 011 — alíquotas uniformes reduzidas (gRed em gIBSUF/gIBSMun/gCBS)
217+ # ------------------------------------------------------------------
218+ def test_cst011_reducao_aliquota_com_gred (self ):
219+ emitente = self ._emitente ()
220+ cliente = self ._cliente ()
221+ nf = self ._nota_fiscal (emitente , cliente )
222+
223+ kwargs = self ._base_product_kwargs ()
224+ kwargs .update (
225+ ibscbs_cst = "011" ,
226+ ibscbs_c_class_trib = "000003" ,
227+ ibscbs_vbc = Decimal ("1000.00" ),
228+ ibscbs_p_ibs_uf = Decimal ("0.1000" ),
229+ ibscbs_v_ibs_uf = Decimal ("1.00" ),
230+ ibscbs_ibs_uf_p_red_aliq = Decimal ("60.0000" ),
231+ ibscbs_ibs_uf_p_aliq_efet = Decimal ("0.0400" ),
232+ ibscbs_p_ibs_mun = Decimal ("0.0500" ),
233+ ibscbs_v_ibs_mun = Decimal ("0.50" ),
234+ ibscbs_ibs_mun_p_red_aliq = Decimal ("60.0000" ),
235+ ibscbs_ibs_mun_p_aliq_efet = Decimal ("0.0200" ),
236+ ibscbs_v_ibs = Decimal ("1.50" ),
237+ ibscbs_p_cbs = Decimal ("0.9000" ),
238+ ibscbs_v_cbs = Decimal ("9.00" ),
239+ ibscbs_cbs_p_red_aliq = Decimal ("60.0000" ),
240+ ibscbs_cbs_p_aliq_efet = Decimal ("0.3600" ),
241+ )
242+ nf .adicionar_produto_servico (** kwargs )
243+ nf .adicionar_pagamento (t_pag = "01" , x_pag = "Dinheiro" , v_pag = 1000.00 , ind_pag = 0 )
244+
245+ xml = self ._serializar_e_assinar ()
246+
247+ # CST 011 is taxable — gIBSCBS present
248+ gibscbs = xml .xpath ("//ns:IBSCBS/ns:gIBSCBS" , namespaces = self .ns )
249+ self .assertEqual (len (gibscbs ), 1 )
250+
251+ # gIBSUF/gRed
252+ gred_uf = xml .xpath ("//ns:IBSCBS/ns:gIBSCBS/ns:gIBSUF/ns:gRed" , namespaces = self .ns )
253+ self .assertEqual (len (gred_uf ), 1 )
254+ self .assertEqual (
255+ xml .xpath ("//ns:IBSCBS/ns:gIBSCBS/ns:gIBSUF/ns:gRed/ns:pRedAliq" , namespaces = self .ns )[
256+ 0
257+ ].text ,
258+ "60.0000" ,
259+ )
260+ self .assertEqual (
261+ xml .xpath ("//ns:IBSCBS/ns:gIBSCBS/ns:gIBSUF/ns:gRed/ns:pAliqEfet" , namespaces = self .ns )[
262+ 0
263+ ].text ,
264+ "0.0400" ,
265+ )
266+
267+ # gIBSMun/gRed
268+ gred_mun = xml .xpath ("//ns:IBSCBS/ns:gIBSCBS/ns:gIBSMun/ns:gRed" , namespaces = self .ns )
269+ self .assertEqual (len (gred_mun ), 1 )
270+ self .assertEqual (
271+ xml .xpath ("//ns:IBSCBS/ns:gIBSCBS/ns:gIBSMun/ns:gRed/ns:pRedAliq" , namespaces = self .ns )[
272+ 0
273+ ].text ,
274+ "60.0000" ,
275+ )
276+ self .assertEqual (
277+ xml .xpath ("//ns:IBSCBS/ns:gIBSCBS/ns:gIBSMun/ns:gRed/ns:pAliqEfet" , namespaces = self .ns )[
278+ 0
279+ ].text ,
280+ "0.0200" ,
281+ )
282+
283+ # gCBS/gRed
284+ gred_cbs = xml .xpath ("//ns:IBSCBS/ns:gIBSCBS/ns:gCBS/ns:gRed" , namespaces = self .ns )
285+ self .assertEqual (len (gred_cbs ), 1 )
286+ self .assertEqual (
287+ xml .xpath ("//ns:IBSCBS/ns:gIBSCBS/ns:gCBS/ns:gRed/ns:pRedAliq" , namespaces = self .ns )[
288+ 0
289+ ].text ,
290+ "60.0000" ,
291+ )
292+ self .assertEqual (
293+ xml .xpath ("//ns:IBSCBS/ns:gIBSCBS/ns:gCBS/ns:gRed/ns:pAliqEfet" , namespaces = self .ns )[
294+ 0
295+ ].text ,
296+ "0.3600" ,
297+ )
298+
211299 # ------------------------------------------------------------------
212- # Test 2: CST 222 — isenção (no vBC, values zero)
300+ # Test 2: CST 400 — isenção (no vBC, values zero)
213301 # ------------------------------------------------------------------
214- def test_cst222_isencao_sem_valores (self ):
302+ def test_cst400_isencao_sem_valores (self ):
215303 emitente = self ._emitente ()
216304 cliente = self ._cliente ()
217305 nf = self ._nota_fiscal (emitente , cliente )
@@ -225,7 +313,7 @@ def test_cst222_isencao_sem_valores(self):
225313 valor_total_bruto = Decimal ("50.00" ),
226314 quantidade_tributavel = Decimal ("1" ),
227315 valor_unitario_tributavel = Decimal ("50.00" ),
228- ibscbs_cst = "222 " ,
316+ ibscbs_cst = "400 " ,
229317 ibscbs_c_class_trib = "000002" ,
230318 )
231319 nf .adicionar_produto_servico (** kwargs )
@@ -239,13 +327,13 @@ def test_cst222_isencao_sem_valores(self):
239327
240328 # CST present
241329 cst = xml .xpath ("//ns:IBSCBS/ns:CST" , namespaces = self .ns )[0 ].text
242- self .assertEqual (cst , "222 " )
330+ self .assertEqual (cst , "400 " )
243331
244332 # cClassTrib present
245333 cclass = xml .xpath ("//ns:IBSCBS/ns:cClassTrib" , namespaces = self .ns )[0 ].text
246334 self .assertEqual (cclass , "000002" )
247335
248- # No gIBSCBS group (CST 222 is not in taxable CSTs)
336+ # No gIBSCBS group (CST 400 is not in taxable CSTs)
249337 gibscbs = xml .xpath ("//ns:IBSCBS/ns:gIBSCBS" , namespaces = self .ns )
250338 self .assertEqual (len (gibscbs ), 0 )
251339
0 commit comments