def test_check_attr(self): types = [None, True, 1, "", "string", [], (), {}] # pass: empty list self.assertIsNone(PXML.check_attr([])) # pass: list of 2-tuple (tuple elements are strings) for element in permutations([t for t in types if isinstance(t, str)], 2): self.assertIsNone(PXML.check_attr([element])) # fail: non-list for element in [t for t in types if not isinstance(t, list)]: with self.assertRaises(TypeError): PXML.check_attr(element) # fail: 1 element list (element is not a 2-tuple of strings) for element in permutations(types, 1): with self.assertRaises(TypeError): PXML.check_attr(list(element)) # fail: 2 element list (elements are not a 2-tuple of strings) for element in permutations(types, 2): with self.assertRaises(TypeError): PXML.check_attr(list(element)) # fail: 3 element list (elements are not a 2-tuple of strings) for element in permutations(types, 3): with self.assertRaises(TypeError): PXML.check_attr(list(element)) # fail: list of 1-tuple for element in permutations(types, 1): with self.assertRaises(TypeError): PXML.check_attr([element]) # fail: list of 2-tuple (tuple elements are non-strings) for element in permutations([t for t in types if not isinstance(t, str)], 2): with self.assertRaises(TypeError): PXML.check_attr([element]) # fail: list of 3-tuple for element in permutations(types, 3): with self.assertRaises(TypeError): PXML.check_attr([element])