Skip to content

Commit 02adfa0

Browse files
Merge pull request #2 from tomorrowdevs-projects/fix-test-new-structure
change module name and input type to str
2 parents 86ad3f1 + fea90fa commit 02adfa0

File tree

9 files changed

+26
-21
lines changed

9 files changed

+26
-21
lines changed

projects/001-area-of-a-room/python/test_area_of_a_room.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class TestAreaOfARoom(TestCase):
1515

1616
def setUp(self) -> None:
17-
self.module_name = 'projects.m1.001-area-of-a-room.python.main'
17+
self.module_name = 'projects.001-area-of-a-room.python.main'
1818

1919
@skipIf(is_file_empty, 'Empty file')
2020
@patch('builtins.input')

projects/002-bottle-deposits/python/test_bottle_deposits.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class TestBottleDeposits(TestCase):
1515

1616
def setUp(self) -> None:
17-
self.module_name = 'projects.m1.002-bottle-deposits.python.main'
17+
self.module_name = 'projects.002-bottle-deposits.python.main'
1818

1919
@skipIf(is_file_empty, 'Empty file')
2020
@patch('builtins.input')
@@ -23,7 +23,7 @@ def test_ok(self, mock_inputs):
2323
Check correctly result with inputs int
2424
"""
2525

26-
mock_inputs.side_effect = [1, 2] # small, big
26+
mock_inputs.side_effect = ['1', '2'] # small, big
2727

2828
with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
2929
sys.modules.pop(self.module_name, None)
@@ -43,7 +43,7 @@ def test_ok_only_small(self, mock_inputs):
4343
Check correctly result only the first input value
4444
"""
4545

46-
mock_inputs.side_effect = [1, 0] # small, big
46+
mock_inputs.side_effect = ['1', '0'] # small, big
4747

4848
with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
4949
sys.modules.pop(self.module_name, None)
@@ -63,7 +63,7 @@ def test_ok_only_big(self, mock_inputs):
6363
Check correctly result only the second input value
6464
"""
6565

66-
mock_inputs.side_effect = [0, 4] # small, big
66+
mock_inputs.side_effect = ['0', '4'] # small, big
6767

6868
with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
6969
sys.modules.pop(self.module_name, None)

projects/003-making-change/python/test_making_change.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class TestMakingChange(TestCase):
1515

1616
def setUp(self) -> None:
17-
self.module_name = 'projects.m1.003-making-change.python.main'
17+
self.module_name = 'projects.003-making-change.python.main'
1818

1919
@staticmethod
2020
def format_output(output: str) -> set:
@@ -48,7 +48,7 @@ def test_ok(self, mock_input):
4848
"""
4949
Check if return a correct result
5050
"""
51-
mock_input.return_value = 742
51+
mock_input.return_value = '742'
5252

5353
good_result = {('toonies', '3'), ('loonies', '1'), ('quarters', '1'),
5454
('dimes', '1'), ('nickels', '1'), ('pennies', '2')}

projects/004-units-of-time/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
Create a program that reads a duration from the user as a number of days, hours, minutes, and seconds.
44
Compute and display the total number of seconds represented by this duration.
55

6+
Example:
7+
- Input days: 1
8+
- Input hours: 10
9+
- Input minutes: 12
10+
- Input seconds: 32
11+
- Result seconds: 123152
612
# Documentation
713

814
For this project solution you may use:

projects/004-units-of-time/python/test_units_of_time.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class TestUnitsOfTime(TestCase):
1515

1616
def setUp(self) -> None:
17-
self.module_name = 'projects.m1.004-units-of-time.python.main'
17+
self.module_name = 'projects.004-units-of-time.python.main'
1818

1919
@skipIf(is_file_empty, 'Empty file')
2020
@patch('builtins.input')

projects/005-units-of-time-again/python/test_units_of_time_again.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import importlib
22
import io
33
import os
4-
import re
54
import sys
65
from pathlib import Path
76
from unittest import TestCase, skipIf
@@ -14,7 +13,7 @@
1413
class TestUnitsOfTimeAgain(TestCase):
1514

1615
def setUp(self) -> None:
17-
self.module_name = 'projects.m1.005-units-of-time-again.python.main'
16+
self.module_name = 'projects.005-units-of-time-again.python.main'
1817

1918
@skipIf(is_file_empty, 'Empty file')
2019
@patch('builtins.input')
@@ -23,7 +22,7 @@ def test_ok(self, mock_input):
2322
Check if return the correct result
2423
"""
2524

26-
mock_input.return_value = 3849830
25+
mock_input.return_value = '3849830'
2726

2827
with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
2928
sys.modules.pop(self.module_name, None)
@@ -39,7 +38,7 @@ def test_ok_empty(self, mock_input):
3938
Check if return the correct result
4039
"""
4140

42-
mock_input.return_value = 0
41+
mock_input.return_value = '0'
4342

4443
with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
4544
sys.modules.pop(self.module_name, None)

projects/006-sum-of-digits-in-a-integer/python/test_sum_of_digits_in_a_integer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class TestSumOfDigitsInAInteger(TestCase):
1515

1616
def setUp(self) -> None:
17-
self.module_name = 'projects.m1.006-sum-of-digits-in-a-integer.python.main'
17+
self.module_name = 'projects.006-sum-of-digits-in-a-integer.python.main'
1818

1919
@skipIf(is_file_empty, 'Empty file')
2020
@patch('builtins.input')

projects/007-day-old-bread/python/test_day_old_bread.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class TestDayOldBread(TestCase):
1515

1616
def setUp(self) -> None:
17-
self.module_name = 'projects.m1.007-day-old-bread.python.main'
17+
self.module_name = 'projects.007-day-old-bread.python.main'
1818

1919
@skipIf(is_file_empty, 'Empty file')
2020
@patch('builtins.input')
@@ -23,7 +23,7 @@ def test_ok(self, mock_input):
2323
Check if return the correct result
2424
"""
2525

26-
mock_input.return_value = 342
26+
mock_input.return_value = '342'
2727

2828
with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
2929
sys.modules.pop(self.module_name, None)
@@ -39,7 +39,7 @@ def test_ok_0_input(self, mock_input):
3939
Check if return the correct result
4040
"""
4141

42-
mock_input.return_value = 0
42+
mock_input.return_value = '0'
4343

4444
with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
4545
sys.modules.pop(self.module_name, None)

projects/008-dog-years/python/test_dog_years.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
class TestDogYears(TestCase):
1515

1616
def setUp(self) -> None:
17-
self.module_name = 'projects.m1.008-dog-years.python.main'
17+
self.module_name = 'projects.008-dog-years.python.main'
1818

1919
@skipIf(is_file_empty, 'Empty file')
2020
@patch('builtins.input')
@@ -23,7 +23,7 @@ def test_ok_1(self, mock_input):
2323
Check if return the correct result
2424
"""
2525

26-
mock_input.return_value = 1
26+
mock_input.return_value = '1'
2727

2828
with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
2929
sys.modules.pop(self.module_name, None)
@@ -39,7 +39,7 @@ def test_ok_2(self, mock_input):
3939
Check if return the correct result
4040
"""
4141

42-
mock_input.return_value = 2
42+
mock_input.return_value = '2'
4343

4444
with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
4545
sys.modules.pop(self.module_name, None)
@@ -55,7 +55,7 @@ def test_ok_greater_than_2(self, mock_input):
5555
Check if return the correct result
5656
"""
5757

58-
mock_input.return_value = 35
58+
mock_input.return_value = '35'
5959

6060
with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
6161
sys.modules.pop(self.module_name, None)
@@ -71,7 +71,7 @@ def test_ok_negative(self, mock_input):
7171
Check if return the correct result
7272
"""
7373

74-
mock_input.return_value = 0
74+
mock_input.return_value = '0'
7575

7676
with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
7777
sys.modules.pop(self.module_name, None)

0 commit comments

Comments
 (0)