Skip to content

Commit

Permalink
- apply linter changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Jul 12, 2020
1 parent 8d4a732 commit 3bfa74b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
23 changes: 15 additions & 8 deletions src/roman.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from __future__ import print_function


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

__author__ = "Mark Pilgrim (f8dy@diveintopython.org)"
Expand All @@ -22,16 +24,20 @@


# Define exceptions
class RomanError(Exception): pass
class RomanError(Exception):
pass


class OutOfRangeError(RomanError): pass
class OutOfRangeError(RomanError):
pass


class NotIntegerError(RomanError): pass
class NotIntegerError(RomanError):
pass


class InvalidRomanNumeralError(RomanError): pass
class InvalidRomanNumeralError(RomanError):
pass


# Define digit mapping
Expand Down Expand Up @@ -110,10 +116,11 @@ def parse_args():
description='convert between roman and arabic numerals'
)
parser.add_argument('number', help='the value to convert')
parser.add_argument('-r', '--reverse',
action='store_true',
default=False,
help='convert roman to numeral (case insensitive) [default: False]')
parser.add_argument(
'-r', '--reverse',
action='store_true',
default=False,
help='convert roman to numeral (case insensitive) [default: False]')

args = parser.parse_args()
args.number = args.number
Expand Down
4 changes: 3 additions & 1 deletion src/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
import sys
import unittest


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

import roman


TEST_MAP = ((0, 'N'), (1, 'I'), (3, 'III'), (4, 'IV'), (9, 'IX'), (14, 'XIV'),
(19, 'XIX'), (24, 'XXIV'), (40, 'XL'), (49, 'XLIX'), (90, 'XC'),
(99, 'XCIX'), (400, 'CD'), (490, 'CDXC'), (499, 'CDXCIX'),
Expand All @@ -18,7 +20,7 @@
if sys.version_info[0] > 2:
_str = str
else:
_str = unicode
_str = unicode # NOQA: F821


class TestRoman(unittest.TestCase):
Expand Down

0 comments on commit 3bfa74b

Please sign in to comment.