def test_should_anticipate_correctly(self, cfg): # given cls = Classifier(effect='#1####0#', cfg=cfg) p0 = Perception('00001111') p1 = Perception('01001101') # then assert cls.does_anticipate_correctly(p0, p1) is True
def test_should_detect_correct_anticipation_1(self, cfg): # Classifier is not predicting any change, all pass-through effect # should predict correctly # given cls = Classifier(effect=Effect('########'), cfg=cfg) p0 = Perception('00001111') p1 = Perception('00001111') # then assert cls.does_anticipate_correctly(p0, p1) is True
def test_should_detect_correct_anticipation_6(self, cfg): # Case when effect predicts situation incorrectly # given cls = Classifier(effect=Effect( ['#', '#', '1', '#', '0', '#', '0', '#']), cfg=cfg) p0 = Perception(['0', '0', '0', '1', '1', '0', '1', '0']) p1 = Perception(['0', '0', '1', '1', '0', '0', '0', '0']) # then assert cls.does_anticipate_correctly(p0, p1) is True
def test_should_handle_pass_through_symbol(self, cfg): # A case when there was no change in perception but effect has no # pass-through symbol # given cls = Classifier(effect=Effect( ['#', '0', '#', '#', '#', '#', '#', '#']), cfg=cfg) p0 = Perception(['0', '0', '0', '0', '1', '1', '1', '1']) p1 = Perception(['0', '0', '0', '0', '1', '1', '1', '1']) # then assert cls.does_anticipate_correctly(p0, p1) is False
def test_should_detect_correct_anticipation_2(self, cfg): # Introduce two changes into situation and effect (should # also predict correctly) # given cls = Classifier(effect=Effect( ['#', '1', '#', '#', '#', '#', '0', '#']), cfg=cfg) p0 = Perception(['0', '0', '0', '0', '1', '1', '1', '1']) p1 = Perception(['0', '1', '0', '0', '1', '1', '0', '1']) # then assert cls.does_anticipate_correctly(p0, p1) is True