def test_afw_intersection_equals(self): """ Tests a correct afw intersection with the same afw """ AFW.rename_afw_states(self.afw_intersection_1_test_01, 'a_') intersection = AFW.afw_intersection(self.afw_intersection_1_test_01, self.afw_intersection_1_test_01) i = 0 last = 7 while i <= last: base = list(itertools.repeat('a', i)) base += list(itertools.repeat('b', i)) # build all permutation of 'a' and 'b' till length i word_set = set(itertools.permutations(base, i)) for word in word_set: word = list(word) original_acceptance_1 = AFW.afw_word_acceptance( self.afw_intersection_1_test_01, word) original_acceptance_2 = AFW.afw_word_acceptance( self.afw_intersection_1_test_01, word) intersection_acceptance = AFW.afw_word_acceptance(intersection, word) self.assertEqual( original_acceptance_1 and original_acceptance_2, intersection_acceptance) i += 1
def test_afw_intersection_empty_states_2(self): """ Tests a afw intersection where the second afw is empty """ intersection = AFW.afw_intersection(self.afw_intersection_1_test_01, self.afw_intersection_test_empty) i = 0 last = 7 while i <= last: base = list(itertools.repeat('a', i)) base += list(itertools.repeat('b', i)) # build all permutation of 'a' and 'b' till length i word_set = set(itertools.permutations(base, i)) for word in word_set: word = list(word) original_acceptance_1 = AFW.afw_word_acceptance( self.afw_intersection_1_test_01, word) original_acceptance_2 = AFW.afw_word_acceptance( self.afw_intersection_test_empty, word) intersection_acceptance = AFW.afw_word_acceptance(intersection, word) self.assertEqual( original_acceptance_1 and original_acceptance_2, intersection_acceptance) i += 1
def test_afw_intersection_side_effects_2(self): """ Tests the function makes side effect on the second input """ before = copy.deepcopy(self.afw_intersection_2_test_01) AFW.afw_intersection(self.afw_intersection_1_test_01, self.afw_intersection_2_test_01) self.assertEqual(before, self.afw_intersection_2_test_01)
def test_afw_intersection_wrong_dict_2(self): """ Tests a dict() in input different from a well formatted dict() representing a AFW. [EXPECTED FAILURE]""" AFW.afw_intersection({'goofy': 'donald'}, self.afw_intersection_1_test_01)
def test_afw_intersection_wrong_input_2(self): """ Tests an input different from a dict() object. [EXPECTED FAILURE]""" AFW.afw_intersection(self.afw_intersection_1_test_01, 0)