Exemplo n.º 1
0
def test_model_parse_module_missing_class():
    """Test Model.parse_module when a class is missing."""
    skill_context = SkillContext(skill=MagicMock(
        skill_id=PublicId.from_str("author/name:0.1.0")))
    dummy_models_path = Path(ROOT_DIR, "tests", "data", "dummy_skill")
    with unittest.mock.patch.object(aea.skills.base._default_logger,
                                    "warning") as mock_logger_warning:
        models_by_id = Model.parse_module(
            dummy_models_path,
            {
                "dummy_model": SkillComponentConfiguration("DummyModel"),
                "unknown_model": SkillComponentConfiguration("UnknownModel"),
            },
            skill_context,
        )
        mock_logger_warning.assert_called_with(
            "Model 'UnknownModel' cannot be found.")
        assert "dummy_model" in models_by_id
Exemplo n.º 2
0
def test_model_parse_module_without_configs():
    """Call Model.parse_module without configurations."""
    assert Model.parse_module(MagicMock(), {}, MagicMock()) == {}