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

arreglo de la primera linea #21

Open
wants to merge 34 commits into
base: arregloDeCodigoPEP8
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a6c9245
change array identation
eb-francisco Feb 26, 2018
2f03242
Fixed whitespace around arithmetic operation file roman_to_number lin…
eb-fmezzabotta Feb 26, 2018
16d8775
eliminar dos espacios en blanco del diccionario
agustin18 Feb 26, 2018
3aff876
primer linea arreglada
danteC94 Feb 26, 2018
dd0ada5
Merge pull request #9 from evbeda/whitespaces
eldalai Feb 26, 2018
1f3fb85
Merge pull request #11 from evbeda/two_spaces_before
eldalai Feb 26, 2018
73f87fa
add line 18
PKpacheco Feb 26, 2018
6e9a156
Fixed whitespace line 41 test_roman.py
eb-fmezzabotta Feb 26, 2018
5b1dbe0
Merge pull request #13 from evbeda/rama_dante
eldalai Feb 26, 2018
62feb85
add line 8
PKpacheco Feb 26, 2018
0f03098
Se arreglo el dos puntos del caracter M
agustin18 Feb 26, 2018
3873f79
mend
eb-francisco Feb 26, 2018
7f041fd
Fixed whitespace line 41 test_roman.py
eb-fmezzabotta Feb 26, 2018
95d522a
Fixed line too long test_roman_to_int line 32
eb-fmezzabotta Feb 26, 2018
9090425
Merge pull request #18 from evbeda/update3_pk
eldalai Feb 26, 2018
3369c43
Merge pull request #10 from evbeda/brachIndentArray
eldalai Feb 26, 2018
08d7cb2
Merge pull request #17 from evbeda/100M
eldalai Feb 26, 2018
cccd586
Merge pull request #14 from evbeda/update2_pk
eldalai Feb 26, 2018
19bbf7d
Merge pull request #16 from evbeda/whitespaces1
eldalai Feb 26, 2018
71efccc
900
agustin18 Feb 26, 2018
c595c93
Merge pull request #22 from evbeda/900
eldalai Feb 26, 2018
1d94f5a
Fixed line too long test_roman_to_int line 32
eb-fmezzabotta Feb 26, 2018
c2e52de
Added EOF line to test_suite.py
eb-fmezzabotta Feb 26, 2018
43454a1
spaces500
agustin18 Feb 26, 2018
adcdde4
Merge pull request #25 from evbeda/500
eldalai Feb 26, 2018
968105e
Merge pull request #24 from evbeda/whitespaces3
eldalai Feb 26, 2018
45c1dc4
Merge pull request #20 from evbeda/whitespaces2
eldalai Feb 26, 2018
bcbf379
modify Romany.py
manuelcorrales Feb 26, 2018
696952c
Merge pull request #19 from evbeda/manubranch
eldalai Feb 26, 2018
b173c44
add testing coverage
eldalai Feb 26, 2018
8057380
support coverage
gabrielf-eb Feb 26, 2018
277d084
Merge pull request #28 from evbeda/support-coverage
eldalai Feb 26, 2018
eb7f55a
fix support coverage
gabrielf-eb Feb 26, 2018
5b93f6d
Merge pull request #29 from evbeda/fix-support-coverage
eldalai Feb 26, 2018
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
4 changes: 1 addition & 3 deletions Roman.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ def roman(numero):

if not isinstance(numero, int):
return "Only int numbers"


numeros = {
1000 :'M',
1000: 'M',
900 :'CM',
500 :'D',
400 :'CD',
Expand Down
27 changes: 22 additions & 5 deletions roman_to_decimal.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@

def decimal(roman):
roma = {'M': 1000, 'D': 500, 'C': 100, 'L': 50, 'X': 10, 'V': 5, 'I': 1}
cadena = list(roman)
result = 0
count = 0
a = ['A', 'B', 'E', 'F', 'G', 'H', 'J', 'K', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'W', 'Y', 'Z']
a = [
'A',
'B',
'E',
'F',
'G',
'H',
'J',
'K',
'N',
'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'W',
'Y',
'Z',
]
if any(x in roman for x in a):
result = 'Input is not a roman number'
else:
for letra in cadena:
if len(cadena) != count + 1:
if len(cadena) > 0:
if roma[letra] < roma[cadena[count+1]]:
if roma[letra] < roma[cadena[count + 1]]:
result -= roma[letra]
else:
result += roma[letra]
Expand All @@ -21,5 +40,3 @@ def decimal(roman):
result += roma[letra]
count += 1
return result


5 changes: 4 additions & 1 deletion romandecimalroman.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
from Roman import roman

def roman_to_roman(romano):
return roman(decimal(romano))
return roman(decimal(romano))



12 changes: 6 additions & 6 deletions test_roman.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_roman_decimal_roman_two(self):
def test_roman_decimal_roman_four(self):
resultado = roman(4)
self.assertEqual(resultado, 'IV')

def test_roman_decimal_roman_ten(self):
resultado = roman(10)
self.assertEqual(resultado, 'X')
Expand All @@ -30,22 +30,22 @@ def test_roman_decimal_roman_five(self):

def test_roman_decimal_roman_845(self):
resultado = roman(845)
self.assertEqual(resultado, 'DCCCXLV')
self.assertEqual(resultado, 'DCCCXLV')

def test_roman_decimal_roman_minor(self):
resultado = roman(-1)
self.assertEqual(resultado, "Can't convert to roman number!")

def test_roman_decimal_roman_not_type(self):
resultado = roman(10.5)
self.assertEqual(resultado, "Only int numbers")
self.assertEqual(resultado, "Only int numbers")

def test_romandecimal_one(self):
self.assertEqual(decimal('I'), 1)

def test_romandecimal_two(self):
self.assertEqual(decimal('II'), 2)

def test_romandecimal_three(self):
self.assertEqual(decimal('III'), 3)

Expand All @@ -70,10 +70,10 @@ def test_roman_decimal_3999(self):

def test_roman_decimal_4000(self):
resultado = roman(4000)
self.assertEqual(resultado, 'Not a valid number')
self.assertEqual(resultado, 'Not a valid number')

## definir primer test

class Roman_to_decimal_to_roman(unittest.TestCase):
def test_I(self):
self.assertEqual(roman_to_roman('I'),'I')
Expand Down
2 changes: 2 additions & 0 deletions test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
)
from test_roman import TestRoman


def suite():
"""
Gather all the tests from this module in a test suite.
Expand All @@ -15,6 +16,7 @@ def suite():
test_suite.addTest(unittest.makeSuite(TestRoman))
return test_suite


if __name__ == "__main__":
#So you can run tests from this module individually.
unittest.main()