Exemple #1
0
 def test_with_unsupported(self):
     """
     WHEN we pass in an unsupported type
     THEN we get back an UnsupportedTypeException
     """
     with pytest.raises(UnsupportedTypeException):
         convert_to_list({})
Exemple #2
0
 def test_with_str(self):
     """
     WHEN we pass in a single string
     THEN we get back a list of 1 item
     """
     returned = convert_to_list('foo')
     assert isinstance(returned, list)
     assert len(returned) == 1
Exemple #3
0
 def test_with_none(self):
     """
     WHEN we pass in None
     THEN we get back an empty list
     """
     returned = convert_to_list(None)
     assert isinstance(returned, list)
     assert len(returned) == 0
     assert returned == []
Exemple #4
0
 def test_with_list(self):
     """
     WHEN we pass in a list
     THEN we get back the same list
     """
     my_list = ['foo', 'bar', 'baz']
     returned = convert_to_list(my_list)
     assert isinstance(returned, list)
     assert len(returned) == 3
     assert returned == my_list
Exemple #5
0
 def blacklist(self, blacklist):
     if validate_str_or_list(blacklist):
         self.__blacklist = convert_to_list(blacklist)
Exemple #6
0
 def nvr_blacklist(self, nvr_blacklist):
     if validate_str_or_list(nvr_blacklist):
         self.__nvr_blacklist = convert_to_list(nvr_blacklist)