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

all strings are Unicode in Python3 #14

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: python
cache: pip
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Yarg is a PyPI client.
>>> import yarg
>>> package = yarg.get("yarg")
>>> package.name
u'yarg'
'yarg'
>>> package.author
Author(name=u'Kura', email=u'kura@kura.io')
Author(name='Kura', email='kura@kura.io')

Full documentation is at <https://yarg.readthedocs.org>.

Expand Down
16 changes: 8 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
master_doc = 'index'

# General information about the project.
project = u'yarg'
copyright = u'{0}, Kura'.format(datetime.datetime.now().year)
project = 'yarg'
copyright = '{0}, Kura'.format(datetime.datetime.now().year)

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -207,8 +207,8 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'yarg.tex', u'yarg Documentation',
u'Kura', 'manual'),
('index', 'yarg.tex', 'yarg Documentation',
'Kura', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -237,8 +237,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'yarg', u'yarg Documentation',
[u'Kura'], 1)
('index', 'yarg', 'yarg Documentation',
['Kura'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -251,8 +251,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'yarg', u'yarg Documentation',
u'Kura', 'yarg', 'One line description of project.',
('index', 'yarg', 'yarg Documentation',
'Kura', 'yarg', 'One line description of project.',
'Miscellaneous'),
]

Expand Down
2 changes: 1 addition & 1 deletion docs/source/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ the URL to your pythonhosted docs.
.. code-block:: python

>>> yarg.get('yarg').docs
u'http://pythonhosted.org//yarg'
'http://pythonhosted.org//yarg'

Why is my `bugtracker` url empty?
---------------------------------
Expand Down
4 changes: 2 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
from yarg import get, HTTPError


class GoodResponse(object):
class GoodResponse:
status_code = 200
package = os.path.join(os.path.dirname(__file__),
'package.json')
content = open(package).read()


class BadResponse(object):
class BadResponse:
status_code = 300
reason = "Mocked"

Expand Down
54 changes: 27 additions & 27 deletions tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,32 @@ def setUp(self):
self.package = json2package(open(package).read())

def test_repr(self):
self.assertEqual(u'<Package yarg>', self.package.__repr__())
self.assertEqual('<Package yarg>', self.package.__repr__())

def test_name(self):
self.assertEqual(u'yarg', self.package.name)
self.assertEqual('yarg', self.package.name)

def test_pypi_url(self):
self.assertEqual(u'http://pypi.python.org/pypi/yarg',
self.assertEqual('http://pypi.python.org/pypi/yarg',
self.package.pypi_url)

def test_summary(self):
self.assertEqual(u'This is the short summary.', self.package.summary)
self.assertEqual('This is the short summary.', self.package.summary)

def test_description(self):
self.assertEqual(u'This is the long description.',
self.assertEqual('This is the long description.',
self.package.description)

def test_homepage(self):
self.assertEqual(u'https://kura.io/yarg/',
self.assertEqual('https://kura.io/yarg/',
self.package.homepage)

def test_bugtracker(self):
self.assertEqual(u'https://github.com/kura/yarg/issues',
self.assertEqual('https://github.com/kura/yarg/issues',
self.package.bugtracker)

def test_docs(self):
self.assertEqual(u'http://yarg.readthedocs.org/',
self.assertEqual('http://yarg.readthedocs.org/',
self.package.docs)

def test_author(self):
Expand All @@ -54,11 +54,11 @@ def test_maintainer(self):
self.package.maintainer)

def test_license(self):
self.assertEqual(u'MIT',
self.assertEqual('MIT',
self.package.license)

def test_license_from_classifiers(self):
self.assertEqual(u'MIT License',
self.assertEqual('MIT License',
self.package.license_from_classifiers)

def test_downloads(self):
Expand All @@ -67,26 +67,26 @@ def test_downloads(self):
self.package.downloads)

def test_classifiers(self):
self.assertEqual([u'Development Status :: 5 - Production/Stable',
u'Intended Audience :: Developers',
u'License :: OSI Approved :: MIT License',
u'Programming Language :: Python',
u'Programming Language :: Python :: 2.6',
u'Programming Language :: Python :: 2.7',
u'Programming Language :: Python :: 3',
u'Programming Language :: Python :: 3.1',
u'Programming Language :: Python :: 3.2',
u'Programming Language :: Python :: 3.3',
u'Programming Language :: Python :: Implementation :: CPython',
u'Programming Language :: Python :: Implementation :: PyPy'],
self.assertEqual(['Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy'],
self.package.classifiers)

def test_release_ids(self):
self.assertEqual([u'0.0.0', u'0.0.2', u'0.0.15'],
self.assertEqual(['0.0.0', '0.0.2', '0.0.15'],
self.package.release_ids)

def test_latest_release_id(self):
self.assertEqual(u'0.0.15', self.package.latest_release_id)
self.assertEqual('0.0.15', self.package.latest_release_id)

def test_has_wheel(self):
self.assertEqual(True, self.package.has_wheel)
Expand All @@ -98,11 +98,11 @@ def test_has_source(self):
self.assertEqual(True, self.package.has_source)

def test_python_versions(self):
self.assertEqual([u'2.6', u'2.7', u'3.1', u'3.2', u'3.3'],
self.assertEqual(['2.6', '2.7', '3.1', '3.2', '3.3'],
self.package.python_versions)

def test_python_implementations(self):
self.assertEqual([u'CPython', u'PyPy'],
self.assertEqual(['CPython', 'PyPy'],
self.package.python_implementations)


Expand All @@ -125,7 +125,7 @@ def test_docs(self):
self.assertEqual(None, self.package.docs)

def test_latest_release_id(self):
self.assertEqual(u'0.0.0', self.package.latest_release_id)
self.assertEqual('0.0.0', self.package.latest_release_id)

def test_has_wheel(self):
self.assertEqual(False, self.package.has_wheel)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
from yarg.parse import _get, Package


class GoodNewestResponse(object):
class GoodNewestResponse:
status_code = 200
xml = os.path.join(os.path.dirname(__file__),
'newest.xml')
content = open(xml).read()


class GoodUpdatedResponse(object):
class GoodUpdatedResponse:
status_code = 200
xml = os.path.join(os.path.dirname(__file__),
'updated.xml')
content = open(xml).read()


class BadResponse(object):
class BadResponse:
status_code = 300
reason = "Mocked"

Expand Down
18 changes: 9 additions & 9 deletions tests/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def setUp(self):
self.package = json2package(open(package).read())

def test_release_ids(self):
self.assertEqual([u'0.0.0', u'0.0.2', u'0.0.15'],
self.assertEqual(['0.0.0', '0.0.2', '0.0.15'],
self.package.release_ids)

def test_release(self):
Expand All @@ -35,7 +35,7 @@ def test_release(self):
def test_repr(self):
release_id = '0.0.2'
release = self.package.release(release_id)[0]
self.assertEqual(u'<Release 0.0.2>', release.__repr__())
self.assertEqual('<Release 0.0.2>', release.__repr__())

def test_release_id(self):
release_id = '0.0.2'
Expand All @@ -57,24 +57,24 @@ def test_release_uploaded(self):
def test_release_python_version(self):
release_id = '0.0.2'
release = self.package.release(release_id)[0]
self.assertEqual(u'2.7', release.python_version)
self.assertEqual('2.7', release.python_version)

def test_release_url(self):
release_id = '0.0.2'
release = self.package.release(release_id)[0]
url = u'https://pypi.python.org/packages/2.7/y/yarg/yarg-0.0.2-py2.py3-none-any.whl'
url = 'https://pypi.python.org/packages/2.7/y/yarg/yarg-0.0.2-py2.py3-none-any.whl'
self.assertEqual(url, release.url)

def test_release_md5(self):
release_id = '0.0.2'
release = self.package.release(release_id)[0]
md5 = u'3e3098611177c34706de2e10476b3e50'
md5 = '3e3098611177c34706de2e10476b3e50'
self.assertEqual(md5, release.md5_digest)

def test_release_filename(self):
release_id = '0.0.2'
release = self.package.release(release_id)[0]
filename = u'yarg-0.0.2-py2.py3-none-any.whl'
filename = 'yarg-0.0.2-py2.py3-none-any.whl'
self.assertEqual(filename, release.filename)

def test_release_size(self):
Expand All @@ -86,20 +86,20 @@ def test_release_size(self):
def test_release_unknown_package_type(self):
release_id = '0.0.0'
release = self.package.release(release_id)[0]
self.assertEqual(u'wheeeel', release.package_type)
self.assertEqual('wheeeel', release.package_type)

def test_release_package_type(self):
release_id = '0.0.2'
release = self.package.release(release_id)[0]
self.assertEqual(u'wheel', release.package_type)
self.assertEqual('wheel', release.package_type)

def test_release_has_sig(self):
release_id = '0.0.2'
release = self.package.release(release_id)[0]
self.assertEqual(True, release.has_sig)

def test_latest_release_id(self):
self.assertEqual(u'0.0.15', self.package.latest_release_id)
self.assertEqual('0.0.15', self.package.latest_release_id)

def test_latest_release(self):
release_id = '0.0.15'
Expand Down
2 changes: 1 addition & 1 deletion yarg/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from .release import Release


class Package(object):
class Package:
"""
A PyPI package.

Expand Down
2 changes: 1 addition & 1 deletion yarg/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def latest_updated_packages(
return i


class Package(object):
class Package:
"""
A PyPI package generated from the RSS feed information.

Expand Down
2 changes: 1 addition & 1 deletion yarg/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from datetime import datetime


class Release(object):
class Release:
"""
A release file from PyPI.

Expand Down