This commit is contained in:
Tim Bentley 2017-12-15 16:19:42 +00:00
parent c25a446839
commit ca936f5e1a
9 changed files with 18 additions and 18 deletions

View File

@ -124,8 +124,8 @@ class TestCategoryActionList(TestCase):
local_list = [a for a in self.list]
# THEN: Make sure they are returned in correct order
assert len(self.list) == 2
assert local_list[0] == self.action1
assert local_list[1] == self.action2
assert local_list[0] is self.action1
assert local_list[1] is self.action2
def test_remove(self):
"""

View File

@ -240,4 +240,4 @@ class TestHttpUtils(TestCase, TestMixin):
# THEN: socket.timeout should have been caught
# NOTE: Test is if $tmpdir/tempfile is still there, then test fails since ftw deletes bad downloaded files
assert not os.path.exists(self.tempfile), 'tempfile should have been deleted'
assert os.path.exists(self.tempfile) is False, 'tempfile should have been deleted'

View File

@ -258,7 +258,7 @@ class TestInit(TestCase, TestMixin):
result = delete_file(None)
# THEN: delete_file should return False
assert not result, "delete_file should return False when called with None"
assert result is False, "delete_file should return False when called with None"
def test_delete_file_path_success(self):
"""
@ -271,7 +271,7 @@ class TestInit(TestCase, TestMixin):
result = delete_file(Path('path', 'file.ext'))
# THEN: delete_file should return True
assert result, 'delete_file should return True when it successfully deletes a file'
assert result is True, 'delete_file should return True when it successfully deletes a file'
def test_delete_file_path_no_file_exists(self):
"""
@ -363,4 +363,4 @@ class TestInit(TestCase, TestMixin):
# THEN: log.exception should be called and get_file_encoding should return None
mocked_log.exception.assert_called_once_with('Error detecting file encoding')
assert not result
assert result is None

View File

@ -60,7 +60,7 @@ class TestOpenLPJsonDecoder(TestCase):
# THEN: The object should be returned unchanged and a Path object should not have been initiated
assert result == {'key': 'value'}
assert not mocked_path.called
assert mocked_path.called is False
def test_json_decode(self):
"""

View File

@ -46,7 +46,7 @@ class TestRegistryProperties(TestCase, RegistryProperties):
# GIVEN an Empty Registry
# WHEN there is no Application
# THEN the application should be none
assert not self.application, 'The application value should be None'
assert self.application is None, 'The application value should be None'
def test_application(self):
"""

View File

@ -213,7 +213,7 @@ class TestShutil(TestCase):
# THEN: :func:`shutil.which` should have been called with the command, and :func:`which` should return None.
mocked_shutil_which.assert_called_once_with('no_command')
assert not result
assert result is None
def test_which_command(self):
"""
@ -256,7 +256,7 @@ class TestPath(TestCase):
result = path_to_str(None)
# THEN: `path_to_str` should return an empty string
assert not result
assert result == ''
def test_path_to_str_path_object(self):
"""
@ -288,7 +288,7 @@ class TestPath(TestCase):
result = str_to_path('')
# THEN: `path_to_str` should return None
assert not result
assert result is None
def test_path_encode_json(self):
"""

View File

@ -45,7 +45,7 @@ ip6_link_local = 'fe80::223:14ff:fe99:d315'
ip6_bad = 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'
class testProjectorUtilities(TestCase):
class TestProjectorUtilities(TestCase):
"""
Validate functions in the projector utilities module
"""
@ -87,7 +87,7 @@ class testProjectorUtilities(TestCase):
valid = verify_ip_address(addr=ip4_bad)
# THEN: Verify we received True
assert not valid, 'Bad IPv4 address should not have been valid'
assert valid is False, 'Bad IPv4 address should not have been valid'
def test_ip6_loopback_valid(self):
"""
@ -117,7 +117,7 @@ class testProjectorUtilities(TestCase):
valid = verify_ip_address(addr=ip6_bad)
# THEN: Validate bad return
assert not valid, 'IPv6 bad address should have been invalid'
assert valid is False, 'IPv6 bad address should have been invalid'
def test_md5_hash(self):
"""

View File

@ -57,13 +57,13 @@ class TestRegistry(TestCase):
# WHEN I try to get back a non existent component
# THEN I will get an exception
temp = Registry().get('test2')
assert not temp, 'None should have been returned for missing service'
assert temp is False, 'None should have been returned for missing service'
# WHEN I try to replace a component I should be allowed
Registry().remove('test1')
# THEN I will get an exception
temp = Registry().get('test1')
assert not temp, 'None should have been returned for deleted service'
assert temp is False, 'None should have been returned for deleted service'
def test_registry_function(self):
"""
@ -142,7 +142,7 @@ class TestRegistry(TestCase):
Registry().remove_function('test1', self.dummy_function_1)
# THEN: The method should not be available.
assert not Registry().functions_list['test1'], 'The function should not be in the dict anymore.'
assert Registry().functions_list['test1'] is None, 'The function should not be in the dict anymore.'
def dummy_function_1(self):
return "function_1"

View File

@ -106,7 +106,7 @@ class TestMainWindow(TestCase, TestMixin):
self.main_window.open_cmd_line_files("")
# THEN the file should not be opened
assert not mocked_load_file.called, 'load_file should not have been called'
assert mocked_load_file.called is False, 'load_file should not have been called'
def test_main_window_title(self):
"""