Exemple #1
0
 def test_convert_to_list_iterable(self):
     for item in ([None], [1, 2, 3], (1, 2, 3), set([1, 2, 3]), ['foo']):
         self.assertEqual(list(item), attributes.convert_to_list(item))
Exemple #2
0
 def test_convert_to_list_non_iterable(self):
     for item in (True, False, 1, 1.2, object()):
         self.assertEqual([item], attributes.convert_to_list(item))
Exemple #3
0
 def test_convert_to_empty_list(self):
     for item in (None, [], (), {}):
         self.assertEqual([], attributes.convert_to_list(item))
Exemple #4
0
 def test_convert_to_list_string(self):
     for item in ('', 'foo'):
         self.assertEqual([item], attributes.convert_to_list(item))
 def test_convert_to_list_iterable(self):
     for item in ([None], [1, 2, 3], (1, 2, 3), set([1, 2, 3]), ['foo']):
         self.assertEqual(list(item), attributes.convert_to_list(item))
 def test_convert_to_list_non_iterable(self):
     for item in (True, False, 1, 1.2, object()):
         self.assertEqual([item], attributes.convert_to_list(item))
 def test_convert_to_list_string(self):
     for item in ('', 'foo'):
         self.assertEqual([item], attributes.convert_to_list(item))
 def test_convert_to_empty_list(self):
     for item in (None, [], (), {}):
         self.assertEqual([], attributes.convert_to_list(item))
Exemple #9
0
 def test_convert_to_list_string(self):
     for item in ("", "foo"):
         self.assertEqual(attributes.convert_to_list(item), [item])
Exemple #10
0
def normalize_port_pair_groups(port_pair_groups):
    port_pair_groups = attr.convert_to_list(port_pair_groups)
    if not port_pair_groups:
        raise PortPairGroupNotSpecified()
    return port_pair_groups
Exemple #11
0
def normalize_port_pair_groups(port_pair_groups):
    port_pair_groups = attr.convert_to_list(port_pair_groups)
    if not port_pair_groups:
        raise PortPairGroupNotSpecified()
    return port_pair_groups