def test_list_is_already_iterable(self): test_list = ['one', 2, 'three', 'four', 5] self.assertTrue(is_iterable(test_list)) test_list2 = iterable(test_list) self.assertTrue(is_iterable(test_list2)) self.assertListEqual(test_list, test_list2) self.assertEqual(test_list, test_list2)
def test_dict_is_already_iterable(self): test_dict = {'one': 1, 2: 'two', 'three': 3, 'four': 4, 5: 'five'} self.assertTrue(is_iterable(test_dict)) test_dict2 = iterable(test_dict) self.assertTrue(is_iterable(test_dict2)) self.assertDictEqual(test_dict, test_dict2) self.assertEqual(test_dict, test_dict2)
def test_make_floats_iterable(self): test_numeric = 1234.056789 test_numeric_list = iterable(test_numeric) self.assertTrue(is_iterable(test_numeric_list)) self.assertIn(test_numeric, test_numeric_list)
def test_make_numeric_iterable(self): test_numeric = 1234 test_numeric_list = iterable(test_numeric) self.assertTrue(is_iterable(test_numeric_list)) self.assertIn(test_numeric, test_numeric_list)
def test_make_bytes_iterable(self): test_bytes = b'test string' test_bytes_list = iterable(test_bytes) self.assertTrue(is_iterable(test_bytes_list)) self.assertIn(test_bytes, test_bytes_list)
def test_make_str_iterable(self): test_string = 'test string' test_strings = iterable(test_string) self.assertTrue(is_iterable(test_strings)) self.assertIn(test_string, test_strings)