From 65af6f00bdd817e7cb41b93e99d3c072f0a9aee1 Mon Sep 17 00:00:00 2001 From: auouymous Date: Tue, 24 Oct 2023 05:05:07 -0600 Subject: [PATCH] Replace assert_ with assertIn or assertTrue. --- mygpoclient/api_test.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/mygpoclient/api_test.py b/mygpoclient/api_test.py index 882b908..854e0ae 100644 --- a/mygpoclient/api_test.py +++ b/mygpoclient/api_test.py @@ -156,9 +156,9 @@ def test_toDictionary_containsMandatoryAttributes(self): action = api.EpisodeAction(FEED_URL_1, EPISODE_URL_1, 'play') dictionary = action.to_dictionary() self.assertEqual(len(list(dictionary.keys())), 3) - self.assert_('podcast' in dictionary) - self.assert_('episode' in dictionary) - self.assert_('action' in dictionary) + self.assertIn('podcast', dictionary) + self.assertIn('episode', dictionary) + self.assertIn('action', dictionary) self.assertEqual(dictionary['podcast'], FEED_URL_1) self.assertEqual(dictionary['episode'], EPISODE_URL_1) self.assertEqual(dictionary['action'], 'play') @@ -169,14 +169,14 @@ def test_toDictionary_containsAllAttributes(self): self.VALID_POSITION, self.VALID_TOTAL) dictionary = action.to_dictionary() self.assertEqual(len(list(dictionary.keys())), 8) - self.assert_('podcast' in dictionary) - self.assert_('episode' in dictionary) - self.assert_('action' in dictionary) - self.assert_('device' in dictionary) - self.assert_('timestamp' in dictionary) - self.assert_('started' in dictionary) - self.assert_('position' in dictionary) - self.assert_('total' in dictionary) + self.assertIn('podcast', dictionary) + self.assertIn('episode', dictionary) + self.assertIn('action', dictionary) + self.assertIn('device', dictionary) + self.assertIn('timestamp', dictionary) + self.assertIn('started', dictionary) + self.assertIn('position', dictionary) + self.assertIn('total', dictionary) self.assertEqual(dictionary['podcast'], FEED_URL_3) self.assertEqual(dictionary['episode'], EPISODE_URL_4) self.assertEqual(dictionary['action'], 'play') @@ -251,7 +251,7 @@ def test_putSubscriptions_withPodcastDevice(self): self.client.put_subscriptions( device, self.ADD), True) self.assert_http_request_count(1) - self.assert_(self.has_put_json_data(self.ADD)) + self.assertTrue(self.has_put_json_data(self.ADD)) def test_updateSubscriptions_raisesValueError_onInvalidAddList(self): self.assertRaises(ValueError, @@ -334,12 +334,12 @@ def test_updateSubscriptions_returnsUpdateResult(self): result = self.client.update_subscriptions(DEVICE_ID_1, self.ADD, self.REMOVE) # result is a UpdateResult object - self.assert_(hasattr(result, 'since')) - self.assert_(hasattr(result, 'update_urls')) + self.assertTrue(hasattr(result, 'since')) + self.assertTrue(hasattr(result, 'update_urls')) self.assertEqual(result.since, self.SINCE) self.assertEqual(result.update_urls, update_urls_expected) self.assert_http_request_count(1) - self.assert_(self.has_posted_json_data(self.ADD_REMOVE_AS_JSON_UPLOAD)) + self.assertTrue(self.has_posted_json_data(self.ADD_REMOVE_AS_JSON_UPLOAD)) def test_pullSubscriptions_raisesInvalidResponse_onEmptyResponse(self): self.set_http_response_value(b'') @@ -473,7 +473,7 @@ def test_uploadEpisodeActions_returnsTimestamp(self): result = self.client.upload_episode_actions(self.ACTIONS) self.assertEqual(result, self.SINCE) self.assert_http_request_count(1) - self.assert_(self.has_posted_json_data(self.ACTIONS_AS_JSON_UPLOAD)) + self.assertTrue(self.has_posted_json_data(self.ACTIONS_AS_JSON_UPLOAD)) def test_downloadEpisodeActions_raisesInvalidResponse_onEmptyResponse( self): @@ -551,7 +551,7 @@ def test_updateDeviceSettings_withNothing(self): result = self.client.update_device_settings(DEVICE_ID_1) self.assertEqual(result, True) self.assert_http_request_count(1) - self.assert_(self.has_posted_json_data({})) + self.assertTrue(self.has_posted_json_data({})) def test_updateDeviceSettings_withCaption(self): self.set_http_response_value(b'') @@ -559,7 +559,7 @@ def test_updateDeviceSettings_withCaption(self): caption='Poodonkis') self.assertEqual(result, True) self.assert_http_request_count(1) - self.assert_(self.has_posted_json_data({'caption': 'Poodonkis'})) + self.assertTrue(self.has_posted_json_data({'caption': 'Poodonkis'})) def test_updateDeviceSettings_withType(self): self.set_http_response_value(b'') @@ -567,7 +567,7 @@ def test_updateDeviceSettings_withType(self): type='desktop') self.assertEqual(result, True) self.assert_http_request_count(1) - self.assert_(self.has_posted_json_data({'type': 'desktop'})) + self.assertTrue(self.has_posted_json_data({'type': 'desktop'})) def test_updateDeviceSettings_withCaptionAndType(self): self.set_http_response_value(b'') @@ -575,7 +575,7 @@ def test_updateDeviceSettings_withCaptionAndType(self): 'My Unit Testing Device', 'desktop') self.assertEqual(result, True) self.assert_http_request_count(1) - self.assert_(self.has_posted_json_data({ + self.assertTrue(self.has_posted_json_data({ 'caption': 'My Unit Testing Device', 'type': 'desktop'}))