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

roman-numerals: sync expected test results and input data with problem-specifications. #1820

Merged
merged 4 commits into from
Jun 11, 2019
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
8 changes: 4 additions & 4 deletions exercises/roman-numerals/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
)


def numeral(number):
s = ''
def roman(number):
result = ''
for arabic, roman in NUMERAL_MAPPINGS:
while number >= arabic:
s += roman
result += roman
number -= arabic
return s
return result
2 changes: 1 addition & 1 deletion exercises/roman-numerals/roman_numerals.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
def numeral(number):
def roman(number):
pass
4 changes: 2 additions & 2 deletions exercises/roman-numerals/roman_numerals_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import roman_numerals


# Tests adapted from `problem-specifications//canonical-data.json` @ v1.2.0


class RomanNumeralsTest(unittest.TestCase):
numerals = {
1: 'I',
Expand All @@ -30,7 +30,7 @@ class RomanNumeralsTest(unittest.TestCase):

def test_numerals(self):
for arabic, numeral in self.numerals.items():
self.assertEqual(roman_numerals.numeral(arabic), numeral)
self.assertEqual(roman_numerals.roman(arabic), numeral)


if __name__ == '__main__':
Expand Down