Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python 3.12 #19

Merged
merged 5 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
matrix:
python-version: ['2.7', '3.6', '3.8', '3.9', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand Down
182 changes: 91 additions & 91 deletions mygpoclient/api_test.py

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions mygpoclient/http_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,12 @@ def test_BadRequest(self):
def test_GET(self):
client = HttpClient()
path = self.URI_BASE + '/noauth'
self.assertEquals(client.GET(path), self.RESPONSE)
self.assertEqual(client.GET(path), self.RESPONSE)

def test_authenticated_GET(self):
client = HttpClient(self.USERNAME, self.PASSWORD)
path = self.URI_BASE + '/auth'
self.assertEquals(client.GET(path), self.RESPONSE)
self.assertEqual(client.GET(path), self.RESPONSE)

def test_unauthenticated_GET(self):
client = HttpClient()
Expand All @@ -186,15 +186,15 @@ def test_unauthenticated_GET(self):
def test_POST(self):
client = HttpClient()
path = self.URI_BASE + '/noauth'
self.assertEquals(
self.assertEqual(
client.POST(
path, self.DUMMYDATA), codecs.encode(
self.DUMMYDATA.decode('utf-8'), 'rot-13').encode('utf-8'))

def test_authenticated_POST(self):
client = HttpClient(self.USERNAME, self.PASSWORD)
path = self.URI_BASE + '/auth'
self.assertEquals(
self.assertEqual(
client.POST(
path, self.DUMMYDATA), codecs.encode(
self.DUMMYDATA.decode('utf-8'), 'rot-13').encode('utf-8'))
Expand All @@ -207,14 +207,14 @@ def test_unauthenticated_POST(self):
def test_PUT(self):
client = HttpClient()
path = self.URI_BASE + '/noauth'
self.assertEquals(client.PUT(path, self.DUMMYDATA), b'PUT OK')
self.assertEqual(client.PUT(path, self.DUMMYDATA), b'PUT OK')

def test_GET_after_PUT(self):
client = HttpClient()
for i in range(10):
path = self.URI_BASE + '/file.%(i)d.txt' % locals()
client.PUT(path, self.RESPONSE + str(i).encode('utf-8'))
self.assertEquals(
self.assertEqual(
client.GET(path),
self.RESPONSE +
str(i).encode('utf-8'))
6 changes: 3 additions & 3 deletions mygpoclient/json_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ def test_parseResponse_worksWithDictionary(self):
client = json.JsonClient(self.USERNAME, self.PASSWORD)
self.mock_setHttpResponse(b'{"a": "B", "c": "D"}')
items = list(sorted(client.GET(self.URI_BASE + '/').items()))
self.assertEquals(items, [('a', 'B'), ('c', 'D')])
self.assertEqual(items, [('a', 'B'), ('c', 'D')])

def test_parseResponse_worksWithIntegerList(self):
client = json.JsonClient(self.USERNAME, self.PASSWORD)
self.mock_setHttpResponse(b'[1,2,3,6,7]')
self.assertEquals(client.GET(self.URI_BASE + '/'), [1, 2, 3, 6, 7])
self.assertEqual(client.GET(self.URI_BASE + '/'), [1, 2, 3, 6, 7])

def test_parseResponse_emptyString_returnsNone(self):
client = json.JsonClient(self.USERNAME, self.PASSWORD)
self.mock_setHttpResponse(b'')
self.assertEquals(client.GET(self.URI_BASE + '/'), None)
self.assertEqual(client.GET(self.URI_BASE + '/'), None)

def test_invalidContent_raisesJsonException(self):
client = json.JsonClient(self.USERNAME, self.PASSWORD)
Expand Down
10 changes: 5 additions & 5 deletions mygpoclient/locator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,28 +81,28 @@ def test_unsupported_settings_uri_exception2(self):

def test_subscriptions_uri_no_device(self):
"""Test that no device returns user subscriptions"""
self.assertEquals(self.locator.subscriptions_uri(),
self.assertEqual(self.locator.subscriptions_uri(),
'http://gpodder.net/subscriptions/jane.opml')

def test_root_uri(self):
"""Test that root_uri trivially works"""
self.assertEquals(self.locator.root_uri(),
self.assertEqual(self.locator.root_uri(),
'http://gpodder.net')

def test_create_with_url(self):
"""Test locator creation with a root URL instead of host"""
loc = locator.Locator('hello', 'https://gpo.self.hosted/my')
self.assertEquals(loc.toplist_uri(),
self.assertEqual(loc.toplist_uri(),
'https://gpo.self.hosted/my/toplist/50.opml')

def test_create_with_url_slash(self):
"""Test locator creation with a root URL ending with a slash"""
loc = locator.Locator('hello', 'https://gpo.self.hosted/my/')
self.assertEquals(loc.toplist_uri(),
self.assertEqual(loc.toplist_uri(),
'https://gpo.self.hosted/my/toplist/50.opml')

def test_create_with_host(self):
"""Test locator creation with a host"""
loc = locator.Locator('hello', 'gpo.self.hosted')
self.assertEquals(loc.toplist_uri(),
self.assertEqual(loc.toplist_uri(),
'http://gpo.self.hosted/toplist/50.opml')
24 changes: 12 additions & 12 deletions mygpoclient/public_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,38 +172,38 @@ def setUp(self):
def test_getToplist(self):
self.fake_client.response_value = self.TOPLIST_JSON
result = self.client.get_toplist()
self.assertEquals(result, self.TOPLIST)
self.assertEquals(len(self.fake_client.requests), 1)
self.assertEqual(result, self.TOPLIST)
self.assertEqual(len(self.fake_client.requests), 1)

def test_searchPodcasts(self):
self.fake_client.response_value = self.SEARCHRESULT_JSON
result = self.client.search_podcasts('wicked')
self.assertEquals(result, self.SEARCHRESULT)
self.assertEquals(len(self.fake_client.requests), 1)
self.assertEqual(result, self.SEARCHRESULT)
self.assertEqual(len(self.fake_client.requests), 1)

def test_getPodcastsOfATag(self):
self.fake_client.response_value = self.SEARCHRESULT_JSON
result = self.client.get_podcasts_of_a_tag('wicked')
self.assertEquals(result, self.SEARCHRESULT)
self.assertEquals(len(self.fake_client.requests), 1)
self.assertEqual(result, self.SEARCHRESULT)
self.assertEqual(len(self.fake_client.requests), 1)

def test_getTopTags(self):
self.fake_client.response_value = self.TOPTAGS_JSON
result = self.client.get_toptags()
self.assertEquals(result, self.TOPTAGS)
self.assertEquals(len(self.fake_client.requests), 1)
self.assertEqual(result, self.TOPTAGS)
self.assertEqual(len(self.fake_client.requests), 1)

def test_getPodcastData(self):
self.fake_client.response_value = self.PODCAST_JSON
result = self.client.get_podcast_data(
'http://feeds.feedburner.com/linuxoutlaws')
self.assertEquals(result, self.PODCAST)
self.assertEquals(len(self.fake_client.requests), 1)
self.assertEqual(result, self.PODCAST)
self.assertEqual(len(self.fake_client.requests), 1)

def test_getEpisodeData(self):
self.fake_client.response_value = self.EPISODE_JSON
result = self.client.get_episode_data(
'http://leo.am/podcasts/twit',
'http://www.podtrac.com/pts/redirect.mp3/aolradio.podcast.aol.com/twit/twit0245.mp3')
self.assertEquals(result, self.EPISODE)
self.assertEquals(len(self.fake_client.requests), 1)
self.assertEqual(result, self.EPISODE)
self.assertEqual(len(self.fake_client.requests), 1)
12 changes: 6 additions & 6 deletions mygpoclient/simple_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,20 @@ def test_putSubscriptions(self):
self.fake_client.response_value = b''
result = self.client.put_subscriptions(
self.DEVICE_NAME, self.SUBSCRIPTIONS)
self.assertEquals(result, True)
self.assertEquals(len(self.fake_client.requests), 1)
self.assertEqual(result, True)
self.assertEqual(len(self.fake_client.requests), 1)

def test_getSubscriptions(self):
self.fake_client.response_value = self.SUBSCRIPTIONS_JSON
subscriptions = self.client.get_subscriptions(self.DEVICE_NAME)
self.assertEquals(subscriptions, self.SUBSCRIPTIONS)
self.assertEquals(len(self.fake_client.requests), 1)
self.assertEqual(subscriptions, self.SUBSCRIPTIONS)
self.assertEqual(len(self.fake_client.requests), 1)

def test_getSuggestions(self):
self.fake_client.response_value = self.SUGGESTIONS_JSON
suggestions = self.client.get_suggestions(50)
self.assertEquals(suggestions, self.SUGGESTIONS)
self.assertEquals(len(self.fake_client.requests), 1)
self.assertEqual(suggestions, self.SUGGESTIONS)
self.assertEqual(len(self.fake_client.requests), 1)


class Test_MissingCredentials(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Generic setup script for single-package Python projects
# by Thomas Perl <thp.io/about>

from distutils.core import setup
from setuptools import setup

import re
import os
Expand Down