Skip to content

Commit

Permalink
Drop support for Python 2.7 up to 3.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Feb 10, 2023
1 parent e223d42 commit 8ccb4db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from setuptools import setup


desc = ('%s\n\n%s' % (open('README.rst').read(), open('CHANGES.txt').read()))
desc = ('{}\n\n{}'.format(open('README.rst').read(),
open('CHANGES.txt').read()))

setup(
name='roman',
version='4.0.dev0',
author="Mark Pilgrim",
author_email="f8dy@diveintopython.org",
author_email="zope-dev@zope.dev",
description="Integer to Roman numerals converter",
long_description=desc,
long_description_content_type='text/x-rst',
Expand Down
3 changes: 0 additions & 3 deletions src/roman.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from __future__ import print_function


"""Convert to and from Roman numerals"""

__author__ = "Mark Pilgrim (f8dy@diveintopython.org)"
Expand Down
24 changes: 7 additions & 17 deletions src/tests.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import os
import sys
import unittest


if sys.version_info[0] > 2:
from io import StringIO
else:
from StringIO import StringIO
from io import StringIO

import roman

Expand All @@ -17,18 +12,13 @@
(900, 'CM'), (990, 'CMXC'), (998, 'CMXCVIII'), (999, 'CMXCIX'),
(2013, 'MMXIII'))

if sys.version_info[0] > 2:
_str = str
else:
_str = unicode # NOQA: F821


class TestRoman(unittest.TestCase):

def test_toRoman(self):
for num_arabic, num_roman in TEST_MAP:
self.assertEqual(roman.toRoman(num_arabic), num_roman,
'%s should be %s' % (num_arabic, num_roman))
'{} should be {}'.format(num_arabic, num_roman))

def test_toRoman_errors(self):
self.assertRaises(roman.OutOfRangeError, roman.toRoman, 100000)
Expand All @@ -37,7 +27,7 @@ def test_toRoman_errors(self):
def test_fromRoman(self):
for num_arabic, num_roman in TEST_MAP:
self.assertEqual(roman.fromRoman(num_roman), num_arabic,
'%s should be %s' % (num_roman, num_arabic))
'{} should be {}'.format(num_roman, num_arabic))

def test_fromRoman_errors(self):
self.assertRaises(
Expand All @@ -53,7 +43,7 @@ def test_parse_args(self):

def test_main_toRoman(self):
for num_arabic, num_roman in TEST_MAP:
sys.argv = ['roman', _str(num_arabic)]
sys.argv = ['roman', str(num_arabic)]
sys.stdout = StringIO()
ex_st = roman.main()
output = sys.stdout.getvalue().strip()
Expand All @@ -66,7 +56,7 @@ def test_main_fromRoman(self):
sys.stdout = StringIO()
ex_st = roman.main()
output = sys.stdout.getvalue().strip()
self.assertEqual(output, _str(num_arabic))
self.assertEqual(output, str(num_arabic))
self.assertEqual(ex_st, os.EX_OK)

def test_main_fromRoman_caseInsensitive(self):
Expand All @@ -75,9 +65,9 @@ def test_main_fromRoman_caseInsensitive(self):
sys.stdout = StringIO()
ex_st = roman.main()
output = sys.stdout.getvalue().strip()
self.assertEqual(output, _str(num_arabic))
self.assertEqual(output, str(num_arabic))
self.assertEqual(ex_st, os.EX_OK)


def test_suite():
return unittest.makeSuite(TestRoman)
return unittest.defaultTestLoader.loadTestsFromTestCase(TestRoman)

0 comments on commit 8ccb4db

Please sign in to comment.