def test_find_possible_strings(self): combination = super_algos.find_possible_strings(['a', 'b', 1], 2) self.assertEqual(combination, []) combination = super_algos.find_possible_strings([1], 2) self.assertEqual(combination, []) combination = super_algos.find_possible_strings(['a', 'b'], 1) self.assertEqual(combination, ['a', 'b']) combination = super_algos.find_possible_strings(['a', 'b'], 2) self.assertEqual(combination, ['aa', 'ab', 'ba', 'bb'])
def test_find_possible_strings(self): """ Checks to see if it returns all the possible strings of length from the character set """ self.assertEqual(super_algos.find_possible_strings(['c', 'd'], 2), ['cc', 'cd', 'dc', 'dd']) self.assertEqual( super_algos.find_possible_strings(["x", "y"], 3), ["xxx", "xxy", "xyx", "xyy", "yxx", "yxy", "yyx", "yyy"]) self.assertEqual(super_algos.find_possible_strings(['c', 'd'], 1), ['c', 'd'])
def test_find_possible_strings(self): output = [ 'xxx', 'xxy', 'xxz', 'xyx', 'xyy', 'xyz', 'xzx', 'xzy', 'xzz', 'yxx', 'yxy', 'yxz', 'yyx', 'yyy', 'yyz', 'yzx', 'yzy', 'yzz', 'zxx', 'zxy', 'zxz', 'zyx', 'zyy', 'zyz', 'zzx', 'zzy', 'zzz' ] self.assertEqual(super_algos.find_possible_strings([1, 2, 3, 4], 3), []) self.assertEqual( super_algos.find_possible_strings(['z', 5, 3, 'c'], 3), []) self.assertEqual(super_algos.find_possible_strings(['x', 'y', 'z'], 3), output) self.assertEqual(super_algos.find_possible_strings([], 3), [])
def test_find_possible_strings_works(self): """ tests that the find_possible_strings function works as intended and returns a list of all possible string combinations for a list of characrters of a given length""" result = super_algos.find_possible_strings([ "x", "y", ], 2) self.assertEqual(["xx", "xy", "yx", "yy"], result)
def test_character_combo(self): check = ['a', 'b'] self.assertEqual(super_algos.find_possible_strings(check, 1), ['a', 'b']) self.assertEqual( super_algos.find_possible_strings(check, 2), [ 'aa', 'ab', 'ba', 'bb', ], ) self.assertEqual( super_algos.find_possible_strings(check, 3), ['aaa', 'aab', 'aba', 'abb', 'baa', 'bab', 'bba', 'bbb'])
def test_step3_find_strings_empty(self): result = super_algos.find_possible_strings([], 3) self.assertEqual([], result)
def test_none_FPS(self): self.assertEqual(find_possible_strings(['a', 'b'], 0), [""])
def test_neg_FPS(self): self.assertEqual(find_possible_strings(['a', 'b'], -1), [])
def test_correct_FPS(self): self.assertEqual(find_possible_strings(['a', 'b'], 2), ['aa', 'ab', 'ba', 'bb'])
def test_only_one_FPS(self): self.assertEqual(find_possible_strings(['a', 'b'], 1), ['a', 'b'])
def test_find_possible_strings(self): result = super_algos.find_possible_strings(['q','f'],3) result1 = super_algos.find_possible_strings(['a','b'],2) self.assertEquals(result,['fff', 'ffq', 'fqf', 'fqq', 'qff', 'qfq', 'qqf', 'qqq']) self.assertEquals(result1,['aa', 'ab', 'ba', 'bb'])
def test_no_repetition_in_possible_strings(self): list_count_strings = super_algos.find_possible_strings(['x', 'y'], 3) set_count_strings = set(list_count_strings) self.assertEqual(len(list_count_strings), len(set_count_strings))
def test_find_possible_strings(self): self.assertEqual(super_algos.find_possible_strings(['a','b'],2),['aa','ab','ba','bb']) self.assertEqual(super_algos.find_possible_strings(['x','y'],3),['xxx','xxy','xyx','xyy','yxx','yxy','yyx','yyy']) self.assertEqual(super_algos.find_possible_strings(['a',2,3,4],1),[]) self.assertEqual(super_algos.find_possible_strings([1,'2',3,4],1),[])
def test_step3_find_strings_three(self): result = super_algos.find_possible_strings(['x', 'y'], 3) self.assertEqual( ['xxx', 'xxy', 'xyx', 'xyy', 'yxx', 'yxy', 'yyx', 'yyy'], result)
def test_step3_find_strings_one(self): result = super_algos.find_possible_strings(['a', 'b', 'c'], 1) self.assertEqual(['a', 'b', 'c'], result)
def test_find_possible_strings_not_int(self): """ tests that the find_possible_strings function returns an empty list if integers are declared as an argument for the set""" result = super_algos.find_possible_strings([1, 2, 3], 3) self.assertEqual([], result)
def test_find_possible_strings_empty(self): """ tests that the find_possible_strings function returns an empty list if an empty list is declared as a parameter""" result = super_algos.find_possible_strings([], 3) self.assertEqual([], result)
def test_count_possible_strings_correct(self): self.assertEqual(len(super_algos.find_possible_strings(['x', 'y'], 3)), 8)
def test_step3_find_strings_not_chars(self): result = super_algos.find_possible_strings([1, 2, 3, 4], 3) self.assertEqual([], result)
def test_set_input_to_compute_possible_strings(self): self.assertEqual(super_algos.find_possible_strings(['x', 'x'], 3), -1)
def test_empty_list_FPS(self): self.assertEqual(find_possible_strings([], 4), [])
def test_non_valid_FPS(self): self.assertEqual(find_possible_strings(["1", 2, "3"], 2), [])
Vim�UnDo�p�P~c\bZ|� ��5+�.4:�G��Y$�6M self.assertEqual(super_algos.find_possible_strings([1, 2, 3], 3), [])3=CCCC_J]�%_�����_JK0�%import unittestimport super_algos#class TestAlgos(unittest.TestCase): def test_find_min(self):( # Test list , with str , len > 1@ self.assertEqual(super_algos.find_min([1,-4,"ab",3]),-1)& # Test list , with str , len 18 self.assertEqual(super_algos.find_min(["a"]),-1)& # Test list , no str , len > 1C self.assertEqual(super_algos.find_min([1,-4,2,56,-32]),-32)$ # Test list , no str , len 15 self.assertEqual(super_algos.find_min([2]),2) # Test with empty list5 self.assertEqual(super_algos.find_min([]),-1) def test_sum_all(self):( # Test list , with str , len > 1? self.assertEqual(super_algos.sum_all([1,-4,"ab",3]),-1)& # Test list , with str , len 17 self.assertEqual(super_algos.sum_all(["a"]),-1)& # Test list , no str , len > 1 l = [1,-4,2,56,-32]E self.assertEqual(super_algos.sum_all([1,-4,2,56,-32]),sum(l))$ # Test list , no str , len 14 self.assertEqual(super_algos.sum_all([2]),2) # Test with empty list4 self.assertEqual(super_algos.sum_all([]),-1)( def test_find_possible_string(self): # TestR self.assertEqual(super_algos.find_possible_strings(["x","y","z"],1),"xyz") # Test Empty ListD self.assertEqual(super_algos.find_possible_strings([],3),[]) # Test int listI self.assertEqual(super_algos.find_possible_strings([1,2,3],3),[])5�_�"#����_JK@�!#&' ["x", "y", "z"], 1), "xyz")5�_�"&����_JKC�!#&) ["x", "y", "z"], 1), "x, yz")5�_�"'����_JKE�"#&5�_�"%����_JR��!#&+ ["x", "y", "z"], 1), "x, y, z")5�_�"&����_JR��!#&) ["x", "y", "z"], 1), "xy, z")5�_�"#����_JR��"#&5�_� "!����_JX��!#&' ["x", "y", "z"], 1), "xyz")5�_� "#����_JX��!#&) ["x", "y", "z"], 1), []"xyz")5�_� "'����_JX��!#&( ["x", "y", "z"], 1), ["xyz")5�_� "$����_JX��!#&) ["x", "y", "z"], 1), ["xyz"])5�_� "(����_JX��!#&, ["x", "y", "z"], 1), ["x","yz"])5�_� ����_JX��&import unittestimport super_algos#class TestAlgos(unittest.TestCase): def test_find_min(self):( # Test list , with str , len > 1D self.assertEqual(super_algos.find_min([1, -4, "ab", 3]), -1)& # Test list , with str , len 19 self.assertEqual(super_algos.find_min(["a"]), -1)& # Test list , no str , len > 1H self.assertEqual(super_algos.find_min([1, -4, 2, 56, -32]), -32)$ # Test list , no str , len 16 self.assertEqual(super_algos.find_min([2]), 2) # Test with empty list6 self.assertEqual(super_algos.find_min([]), -1) def test_sum_all(self):( # Test list , with str , len > 1C self.assertEqual(super_algos.sum_all([1, -4, "ab", 3]), -1)& # Test list , with str , len 18 self.assertEqual(super_algos.sum_all(["a"]), -1)& # Test list , no str , len > 1 l = [1, -4, 2, 56, -32]J self.assertEqual(super_algos.sum_all([1, -4, 2, 56, -32]), sum(l))$ # Test list , no str , len 15 self.assertEqual(super_algos.sum_all([2]), 2) # Test with empty list5 self.assertEqual(super_algos.sum_all([]), -1)( def test_find_possible_string(self): # Test; self.assertEqual(super_algos.find_possible_strings(/ ["x", "y", "z"], 1), ["x","y","z"]) # Test Empty ListF self.assertEqual(super_algos.find_possible_strings([], 3), []) # Test int listM self.assertEqual(super_algos.find_possible_strings([1, 2, 3], 3), [])5�_� ".����_JX��"#&5�_� ����_JZ�!& # Test5�_�"����_JZ5�"#&5�_�"0����!0"0V0_JZA �"%&�"#&5�_�$����!0"0V0_JZE�#%(1 ["x", "y", "z"], 1), ["x", "y", "z"])5�_�$����!0"0V0_JZF�#%(2 ["xx", "y", "z"], 1), ["x", "y", "z"])5�_�$����!0"0V0_JZJ�#%(3 ["xx", "xy", "z"], 1), ["x", "y", "z"])5�_�$����!0"0V0_JZL�#%(2 ["xx", "y", "z"], 1), ["x", "y", "z"])5�_�$����!0"0V0_JZN �#%(1 ["x", "y", "z"], 1), ["x", "y", "z"])5�_�$!����!0"0V0_JZ[�#%(1 ["x", "y", "z"], 3), ["x", "y", "z"])5�_�$ ����!0"0V0_JZ[�#&(0 ["x", "y", "z"], 3),["x", "y", "z"])5�_�%����!0"0V0_JZe�$&) ["x", "y", "z"])5�_�%����!0"0V0_JZg�$&) ["xxx", "y", "z"])5�_�%����!0"0V0_JZh�$') ["xxx","y", "z"])5�_�&����!0"0V0_JZl�%'* "y", "z"])5�_�&����!0"0V0_JZn�%'* "xxy", "z"])5�_�&����!0"0V0_JZo �%(* "xxy","z"])5�_� &����!0"0V0_JZs�%(+ "xxy",5�_�! '����!0"0V0_JZx�&(, ""5�_� "!'����!0"0V0_JZz�&(, "",5�_�!#"'����!0"0V0_JZ~�&), "xyx",5�_�"$#(����!0"0V0_JZ��')- ""5�_�#%$(����!0"0V0_JZ��')- "",5�_�$&%(����!0"0V0_JZ��'*- "xyy",5�_�%'&)����!0"0V0_JZ��(*. ""5�_�&(')����!0"0V0_JZ��(*. "",5�_�')()����!0"0V0_JZ��(+. "yxx",5�_�(*)*����!0"0V0_JZ��)+/ ","5�_�)+**����!0"0V0_JZ��)+/ ""5�_�*,+*����!0"0V0_JZ��)+/ "",5�_�+-,*����!0"0V0_JZ��),/ "yxy",5�_�,.-+����!0"0V0_JZ��*,0 ""5�_�-/.+����!0"0V0_JZ��*,0 "",5�_�.0/+����!0"0V0_JZ��*,0 "yy",5�_�/10,����!0"0V0_JZ��+-0 "z"])5�_�021$����!0"0V0_JZ��#%0 ["x", "y", "z"], 3),5�_�142$����!0"0V0_JZ��$%05�_�25340L����/0V_JZ��0�05�_�4651����/0V_JZ��022 # Test int list5�_�5762C����/0V_J[�1M self.assertEqual(super_algos.find_possible_strings([1, 2, 3], 3), [])5�_�6872=����/0V_J[�1J self.assertEqual(super_algos.find_possible_strings([1, 2], 3), [])5�_�7982B����/0V_J[�1L self.assertEqual(super_algos.find_possible_strings(["a", 2], 3), [])5�_�8:92H����/0V_J[�1N self.assertEqual(super_algos.find_possible_strings(["a", "b"], 3), [])5�_�9;:2G����/0V_J[�25�_�:<;"1����/0V_J]*�!$21 ["x", "y", "z"], 1), ["x", "y", "z"])5�_�;=<##����01V_J]7�#$35�_�<>=1L����01V_J]P �143�1235�_�=?>2����01V_J]U�135 # Test int list5�_�>@?3=����01V_J]\!�245M self.assertEqual(super_algos.find_possible_strings([1, 2, 3], 3), [])5�_�?A@3B����01V_J]_"�3455�_�@BA3E����01V_J]|�245O self.assertEqual(super_algos.find_possible_strings(["a", 2, 3], 3), [])5�_�ACB����01V_J]�#�5import unittestimport super_algos#class TestAlgos(unittest.TestCase): def test_find_min(self):( # Test list , with str , len > 1D self.assertEqual(super_algos.find_min([1, -4, "ab", 3]), -1)& # Test list , with str , len 19 self.assertEqual(super_algos.find_min(["a"]), -1)& # Test list , no str , len > 1H self.assertEqual(super_algos.find_min([1, -4, 2, 56, -32]), -32)$ # Test list , no str , len 16 self.assertEqual(super_algos.find_min([2]), 2) # Test with empty list6 self.assertEqual(super_algos.find_min([]), -1) def test_sum_all(self):( # Test list , with str , len > 1C self.assertEqual(super_algos.sum_all([1, -4, "ab", 3]), -1)& # Test list , with str , len 18 self.assertEqual(super_algos.sum_all(["a"]), -1)& # Test list , no str , len > 1 l = [1, -4, 2, 56, -32]J self.assertEqual(super_algos.sum_all([1, -4, 2, 56, -32]), sum(l))$ # Test list , no str , len 15 self.assertEqual(super_algos.sum_all([2]), 2) # Test with empty list5 self.assertEqual(super_algos.sum_all([]), -1)( def test_find_possible_string(self): # Test single char combo; self.assertEqual(super_algos.find_possible_strings(1 ["x", "y", "z"], 1), ["x", "y", "z"])$ # Test multi character combo; self.assertEqual(super_algos.find_possible_strings( ["x", "y"], 3), ["xxx", "xxy", "xyx", "xyy", "yxx", "yxy", "yyx", "yyy"]) # Test Empty ListF self.assertEqual(super_algos.find_possible_strings([], 3), []) # Test int listM self.assertEqual(super_algos.find_possible_strings([1, 2, 3], 3), []) # Test int and str listQ self.assertEqual(super_algos.find_possible_strings(["a", 2, "c"], 3), []) # Test 0 nN self.assertEqual(super_algos.find_possible_strings(["a", "b"], 0), [])5�_�BC3����V_J]�%�3465�_�243/����/2V_JZ��/00�/00 # Test int listM self.assertEqual(super_algos.find_possible_strings([1, 2, 3], 3), [])5��