Пример #1
0
def test_KnowledgeEngine_reset_resets_facts():
    from experta.engine import KnowledgeEngine
    ke = KnowledgeEngine()
    ke.facts = None

    ke.reset()
    assert ke.facts is not None
Пример #2
0
def test_KnowledgeEngine_retract_retracts_fact():
    from experta.engine import KnowledgeEngine
    from unittest.mock import patch

    ke = KnowledgeEngine()
    with patch('experta.factlist.FactList') as mock:
        ke.facts = mock
        ke.retract({'__factid__': (0, )})
        assert mock.retract.called
Пример #3
0
def test_KnowledgeEngine_declare_define_fact():
    from experta.engine import KnowledgeEngine
    from experta import Fact
    from unittest.mock import patch

    ke = KnowledgeEngine()
    with patch('experta.factlist.FactList') as mock:
        ke.facts = mock
        ke.declare(Fact())
        assert mock.declare.called