A few more Truthy value issues Diff comments:
> > === modified file 'tests/functional/openlp_core/common/test_common.py' > --- tests/functional/openlp_core/common/test_common.py 2017-10-07 > 07:05:07 +0000 > +++ tests/functional/openlp_core/common/test_common.py 2017-12-15 > 16:40:42 +0000 > @@ -174,9 +175,9 @@ > mocked_sys.platform = 'win32' > > # THEN: The three platform functions should perform properly > - self.assertTrue(is_win(), 'is_win() should return True') > - self.assertFalse(is_macosx(), 'is_macosx() should return False') > - self.assertFalse(is_linux(), 'is_linux() should return False') > + assert is_win(), 'is_win() should return True' should be assert is_win() is True > + assert is_macosx() is False, 'is_macosx() should return False' > + assert is_linux() is False, 'is_linux() should return False' > > def test_is_macosx(self): > """ > @@ -190,9 +191,9 @@ > mocked_sys.platform = 'darwin' > > # THEN: The three platform functions should perform properly > - self.assertTrue(is_macosx(), 'is_macosx() should return True') > - self.assertFalse(is_win(), 'is_win() should return False') > - self.assertFalse(is_linux(), 'is_linux() should return False') > + assert is_macosx(), 'is_macosx() should return True' should also be is True > + assert is_win() is False, 'is_win() should return False' > + assert is_linux() is False, 'is_linux() should return False' > > def test_is_linux(self): > """ > @@ -206,9 +207,9 @@ > mocked_sys.platform = 'linux3' > > # THEN: The three platform functions should perform properly > - self.assertTrue(is_linux(), 'is_linux() should return True') > - self.assertFalse(is_win(), 'is_win() should return False') > - self.assertFalse(is_macosx(), 'is_macosx() should return False') > + assert is_linux(), 'is_linux() should return True' should also be is True > + assert is_win() is False, 'is_win() should return False' > + assert is_macosx() is False, 'is_macosx() should return False' > > def test_clean_button_text(self): > """ > > === modified file 'tests/functional/openlp_core/common/test_httputils.py' > --- tests/functional/openlp_core/common/test_httputils.py 2017-11-03 > 20:55:41 +0000 > +++ tests/functional/openlp_core/common/test_httputils.py 2017-12-15 > 16:40:42 +0000 > @@ -59,7 +59,7 @@ > > # THEN: The user agent is a Linux (or ChromeOS) user agent > result = 'Linux' in user_agent or 'CrOS' in user_agent > - self.assertTrue(result, 'The user agent should be a valid Linux > user agent') > + assert result, 'The user agent should be a valid Linux user > agent' should also be is True > > def test_get_user_agent_windows(self): > """ > > === modified file 'tests/functional/openlp_core/common/test_init.py' > --- tests/functional/openlp_core/common/test_init.py 2017-11-18 23:14:28 > +0000 > +++ tests/functional/openlp_core/common/test_init.py 2017-12-15 16:40:42 > +0000 > @@ -286,8 +285,8 @@ > result = delete_file(Path('path', 'file.ext')) > > # THEN: The function should not attempt to delete the file and > it should return True > - self.assertFalse(mocked_unlink.called) > - self.assertTrue(result, 'delete_file should return True when the > file doesnt exist') > + assert mocked_unlink.called is False > + assert result, 'delete_file should return True when the file > doesnt exist' should also be is True > > def test_delete_file_path_exception(self): > """ > @@ -345,9 +344,9 @@ > > # THEN: The feed method of UniversalDetector should have been > called twice before returning a result > mocked_open.assert_called_once_with('rb') > - self.assertEqual(mocked_universal_detector_inst.feed.mock_calls, > [call(b"data" * 256), call(b"data" * 4)]) > + assert mocked_universal_detector_inst.feed.mock_calls == > [call(b"data" * 256), call(b"data" * 4)] > mocked_universal_detector_inst.close.assert_called_once_with() > - self.assertEqual(result, encoding_result) > + assert result, encoding_result assert result == encoding_result > > def test_get_file_encoding_oserror(self): > """ > > === modified file > 'tests/functional/openlp_core/common/test_projector_utilities.py' > --- tests/functional/openlp_core/common/test_projector_utilities.py > 2016-12-31 11:01:36 +0000 > +++ tests/functional/openlp_core/common/test_projector_utilities.py > 2017-12-15 16:40:42 +0000 > @@ -57,7 +57,7 @@ > valid = verify_ip_address(addr=ip4_loopback) > > # THEN: Verify we received True > - self.assertTrue(valid, 'IPv4 loopback address should have been > valid') > + assert valid, 'IPv4 loopback address should have been valid' should be assert is True > > def test_ip4_local_valid(self): > """ > @@ -67,7 +67,7 @@ > valid = verify_ip_address(addr=ip4_local) > > # THEN: Verify we received True > - self.assertTrue(valid, 'IPv4 local address should have been valid') > + assert valid, 'IPv4 local address should have been valid' should be assert is True > > def test_ip4_broadcast_valid(self): > """ > @@ -77,7 +77,7 @@ > valid = verify_ip_address(addr=ip4_broadcast) > > # THEN: Verify we received True > - self.assertTrue(valid, 'IPv4 broadcast address should have been > valid') > + assert valid, 'IPv4 broadcast address should have been valid' should be assert is True > > def test_ip4_address_invalid(self): > """ > @@ -97,7 +97,7 @@ > valid = verify_ip_address(addr=ip6_loopback) > > # THEN: Validate return > - self.assertTrue(valid, 'IPv6 loopback address should have been > valid') > + assert valid, 'IPv6 loopback address should have been valid' should be assert is True > > def test_ip6_local_valid(self): > """ > @@ -107,7 +107,7 @@ > valid = verify_ip_address(addr=ip6_link_local) > > # THEN: Validate return > - self.assertTrue(valid, 'IPv6 link-local address should have been > valid') > + assert valid, 'IPv6 link-local address should have been valid' should be assert is True > > def test_ip6_address_invalid(self): > """ -- https://code.launchpad.net/~trb143/openlp/asserts/+merge/335263 Your team OpenLP Core is subscribed to branch lp:openlp. _______________________________________________ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp