Skip to content

Commit 546074e

Browse files
committed
Update py files formats according to flake8
1 parent 5a5e648 commit 546074e

4 files changed

Lines changed: 22 additions & 9 deletions

File tree

funcs/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
# placeholder file to modularize (to package) .py files under the directory "funcs", making the files importable.
1+
# placeholder file to modularize (to package) .py files
2+
# under the directory "funcs", making the files importable.

funcs/func.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
def sum(x: float, y: float) -> float:
22
return x + y
33

4-
def misformatted_func(
5-
var1, var2, var3
6-
):
4+
5+
# def misformatted_func(
6+
# var1, var2, var3
7+
# ):
8+
# print(var1, var2, var3)
9+
10+
11+
def corr_formatted_func(var1, var2, var3):
712
print(var1, var2, var3)

tests/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
# placeholder file to modularize (to package) .py files under the directory "tests", making the files importable.
1+
# placeholder file to modularize (to package) .py files
2+
# under the directory "tests", making the files importable.

tests/test_func.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ class Test(unittest.TestCase):
77
def test_sum(self):
88
self.assertEqual(func.sum(2,3), 5)
99

10-
@patch('funcs.func.misformatted_func')
11-
def test_misformatted_func(self, mock_misformatted_func):
12-
func.misformatted_func("one", "two", "three")
13-
mock_misformatted_func.assert_called_with("one", "two", "three")
10+
# Any misformatted functions would not pass flake8 format checks. All related tests would not be executed.
11+
# @patch('funcs.func.misformatted_func')
12+
# def test_misformatted_func(self, mock_misformatted_func):
13+
# func.misformatted_func("one", "two", "three")
14+
# mock_misformatted_func.assert_called_with("one", "two", "three")
15+
16+
@patch('funcs.func.corr_formatted_func')
17+
def test_corr_formatted_func(self, mock_corr_formatted_func):
18+
func.corr_formatted_func("one", "two", "three")
19+
mock_corr_formatted_func.assert_called_with("one", "two", "three")
1420

1521
if __name__ == "__main__":
1622
unittest.main()

0 commit comments

Comments
 (0)