<commit_before># Copyright 2020 KMEE INFORMATICA LTDA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.tests.common import TransactionCase

from odoo.addons.l10n_br_fiscal.constants.fiscal import PROCESSADOR_OCA


class TestFiscalDocumentNFSeCommon(TransactionCase):
    def setUp(self):
        super(TestFiscalDocumentNFSeCommon, self).setUp()

        self.nfse_same_state = self.env.ref("l10n_br_fiscal.demo_nfse_same_state")
        self.company = self.env.ref("l10n_br_base.empresa_simples_nacional")

        self.company.processador_edoc = PROCESSADOR_OCA
        self.company.partner_id.inscr_mun = "35172"
        self.company.partner_id.inscr_est = ""
        self.company.partner_id.state_id = self.env.ref("base.state_br_mg")
        self.company.partner_id.city_id = self.env.ref("l10n_br_base.city_3132404")
        self.company.icms_regulation_id = self.env.ref(
            "l10n_br_fiscal.tax_icms_regulation"
        ).id
        self.company.city_taxation_code_id = self.env.ref(
            "l10n_br_fiscal.city_taxation_code_itajuba"
        ).id
        self.company.document_type_id = self.env.ref("l10n_br_fiscal.document_SE")
        self.nfse_same_state.company_id = self.company.id

    def test_certified_nfse_same_state_(self):
        """ Test Certified NFSe same state. """

        self.nfse_same_state._onchange_document_serie_id()
        self.nfse_same_state._onchange_fiscal_operation_id()

        # RPS Number
        self.assertEqual(
            self.nfse_same_state.rps_number,
            "50",
            "Error to mappping RPS Number 50"
            " for Venda de Serviço de Contribuinte Dentro do Estado.",
        )

        # RPS Type
        self.assertEqual(
            self.nfse_same_state.rps_type,
            "1",
            "Error to mappping RPS Type 1"<commit_msg>[FIX] l10n_br_nfse: test_fiscal_document_nfse_common.py<commit_after># Copyright 2020 KMEE INFORMATICA LTDA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo.tests.common import TransactionCase

from odoo.addons.l10n_br_fiscal.constants.fiscal import PROCESSADOR_OCA


class TestFiscalDocumentNFSeCommon(TransactionCase):
    def setUp(self):
        super(TestFiscalDocumentNFSeCommon, self).setUp()

        self.nfse_same_state = self.env.ref("l10n_br_fiscal.demo_nfse_same_state")
        self.company = self.env.ref("l10n_br_base.empresa_simples_nacional")

        self.company.processador_edoc = PROCESSADOR_OCA
        self.company.partner_id.inscr_mun = "35172"
        self.company.partner_id.inscr_est = ""
        self.company.partner_id.state_id = self.env.ref("base.state_br_mg")
        self.company.partner_id.city_id = self.env.ref("l10n_br_base.city_3132404")
        self.company.icms_regulation_id = self.env.ref(
            "l10n_br_fiscal.tax_icms_regulation"
        ).id
        self.company.city_taxation_code_id = self.env.ref(
            "l10n_br_fiscal.city_taxation_code_itajuba"
        )
        self.company.document_type_id = self.env.ref("l10n_br_fiscal.document_SE")
        self.nfse_same_state.company_id = self.company.id

    def test_certified_nfse_same_state_(self):
        """ Test Certified NFSe same state. """

        self.nfse_same_state._onchange_document_serie_id()
        self.nfse_same_state._onchange_fiscal_operation_id()

        # RPS Number
        self.assertEqual(
            self.nfse_same_state.rps_number,
            "50",
            "Error to mappping RPS Number 50"
            " for Venda de Serviço de Contribuinte Dentro do Estado.",
        )

        # RPS Type
        self.assertEqual(
            self.nfse_same_state.rps_type,
            "1",
            "Error to mappping RPS Type 1"
{'fraction_non_alphanumeric': 0.09304185550519861, 'fraction_numerical': 0.02079445481205012, 'mean_word_length': 2.832482124616956, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5896494', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1325, 'n_words': 180}