Skip to content

change module name and input type to str #2

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

Merged
merged 1 commit into from
Jul 2, 2023
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
2 changes: 1 addition & 1 deletion projects/001-area-of-a-room/python/test_area_of_a_room.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class TestAreaOfARoom(TestCase):

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

@skipIf(is_file_empty, 'Empty file')
@patch('builtins.input')
Expand Down
8 changes: 4 additions & 4 deletions projects/002-bottle-deposits/python/test_bottle_deposits.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class TestBottleDeposits(TestCase):

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

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

mock_inputs.side_effect = [1, 2] # small, big
mock_inputs.side_effect = ['1', '2'] # small, big

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

mock_inputs.side_effect = [1, 0] # small, big
mock_inputs.side_effect = ['1', '0'] # small, big

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

mock_inputs.side_effect = [0, 4] # small, big
mock_inputs.side_effect = ['0', '4'] # small, big

with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
sys.modules.pop(self.module_name, None)
Expand Down
4 changes: 2 additions & 2 deletions projects/003-making-change/python/test_making_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class TestMakingChange(TestCase):

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

@staticmethod
def format_output(output: str) -> set:
Expand Down Expand Up @@ -48,7 +48,7 @@ def test_ok(self, mock_input):
"""
Check if return a correct result
"""
mock_input.return_value = 742
mock_input.return_value = '742'

good_result = {('toonies', '3'), ('loonies', '1'), ('quarters', '1'),
('dimes', '1'), ('nickels', '1'), ('pennies', '2')}
Expand Down
6 changes: 6 additions & 0 deletions projects/004-units-of-time/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Create a program that reads a duration from the user as a number of days, hours, minutes, and seconds.
Compute and display the total number of seconds represented by this duration.

Example:
- Input days: 1
- Input hours: 10
- Input minutes: 12
- Input seconds: 32
- Result seconds: 123152
# Documentation

For this project solution you may use:
Expand Down
2 changes: 1 addition & 1 deletion projects/004-units-of-time/python/test_units_of_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class TestUnitsOfTime(TestCase):

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

@skipIf(is_file_empty, 'Empty file')
@patch('builtins.input')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import importlib
import io
import os
import re
import sys
from pathlib import Path
from unittest import TestCase, skipIf
Expand All @@ -14,7 +13,7 @@
class TestUnitsOfTimeAgain(TestCase):

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

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

mock_input.return_value = 3849830
mock_input.return_value = '3849830'

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

mock_input.return_value = 0
mock_input.return_value = '0'

with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
sys.modules.pop(self.module_name, None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class TestSumOfDigitsInAInteger(TestCase):

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

@skipIf(is_file_empty, 'Empty file')
@patch('builtins.input')
Expand Down
6 changes: 3 additions & 3 deletions projects/007-day-old-bread/python/test_day_old_bread.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class TestDayOldBread(TestCase):

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

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

mock_input.return_value = 342
mock_input.return_value = '342'

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

mock_input.return_value = 0
mock_input.return_value = '0'

with patch('sys.stdout', new_callable=io.StringIO) as mock_print:
sys.modules.pop(self.module_name, None)
Expand Down
10 changes: 5 additions & 5 deletions projects/008-dog-years/python/test_dog_years.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class TestDogYears(TestCase):

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

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

mock_input.return_value = 1
mock_input.return_value = '1'

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

mock_input.return_value = 2
mock_input.return_value = '2'

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

mock_input.return_value = 35
mock_input.return_value = '35'

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

mock_input.return_value = 0
mock_input.return_value = '0'

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