| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 | import unittestfrom src.models.company_model import company_modelfrom src.settings.settings_manager import settings_managerfrom src.models.measurement_unit_model import measurement_unit_modelfrom src.models.nomenclature_group_model import nomenclature_group_modelfrom src.models.nomenclature_model import nomenclature_modelfrom src.models.warehouse_model import warehouse_modelfrom src.models.abstract_reference import abstract_referencefrom src.errors.argument_exception import argument_exceptionfrom os import pathclass test_models(unittest.TestCase):    def test_company(self):        # Подготовка        setman = settings_manager()        setman.open(path.dirname(__file__) + "/../config/settings.json")        sts = setman.settings            # Действие        company = company_model(sts)            # Проверка        assert isinstance(company, company_model)        print("c", company.tax_id)        print("s", sts.tax_id)        assert company.tax_id == sts.tax_id        assert company.bank_id == sts.bank_id        assert company.bank_account_id == sts.bank_account_id        assert company.property_type == sts.property_type            def test_measurement_unit(self):        # Подготовка        g = measurement_unit_model()        kg = measurement_unit_model(1000, g)            # Действие                    # Проверка        assert isinstance(g, measurement_unit_model)        assert isinstance(kg, measurement_unit_model)        assert g.to_base_unit(1) == 1        assert kg.to_base_unit(1) == 1000    def test_nomenclature(self):        # Подготовка        munit = measurement_unit_model()        fn = "abc"        nom = nomenclature_model(fn, munit, None)            # Действие                    # Проверка        assert isinstance(nom, nomenclature_model)        assert nom.full_name == fn            def test_base_name_validation(self):        # Подготовка        some = abstract_reference()        fn = "abc"            # Действие        some.name = fn            # Проверка        self.assertRaises(argument_exception, some.name(""))        self.assertRaises(argument_exception, some.name(" " * 51))        self.assertRaises(argument_exception, 10)        assert some.name == fn        
 |