Skip to content

Commit 9f8d283

Browse files
add path with empty dir parent
1 parent 27be9b9 commit 9f8d283

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

app/path1/path2/my_file.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class OtherCalculator:
2+
3+
def add(x, y):
4+
return x + y
5+
6+
def subtract(x, y):
7+
return x - y
8+
9+
def multiply(x, y):
10+
return x * y
11+
12+
def divide(x, y):
13+
if y == 0:
14+
return 'Cannot divide by 0'
15+
return x * 1.0 / y
16+
17+
def test(x):
18+
return x

app/path1/path2/test_my_file.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from my_file import OtherCalculator
2+
3+
4+
def test_add():
5+
assert OtherCalculator.add(1, 2) == 3.0
6+
assert OtherCalculator.add(1.0, 2.0) == 3.0
7+
assert OtherCalculator.add(0, 2.0) == 2.0
8+
assert OtherCalculator.add(2.0, 0) == 2.0
9+
assert OtherCalculator.add(-4, 2.0) == -2.0
10+
11+
def test_subtract():
12+
assert OtherCalculator.subtract(1, 2) == -1.0
13+
assert OtherCalculator.subtract(2, 1) == 1.0
14+
assert OtherCalculator.subtract(1.0, 2.0) == -1.0
15+
assert OtherCalculator.subtract(0, 2.0) == -2.0
16+
assert OtherCalculator.subtract(2.0, 0.0) == 2.0
17+
assert OtherCalculator.subtract(-4, 2.0) == -6.0
18+
19+
def test_multiply():
20+
assert OtherCalculator.multiply(1, 2) == 2.0
21+
assert OtherCalculator.multiply(1.0, 2.0) == 2.0
22+
assert OtherCalculator.multiply(0, 2.0) == 0.0
23+
assert OtherCalculator.multiply(2.0, 0.0) == 0.0
24+
assert OtherCalculator.multiply(-4, 2.0) == -8.0
25+
26+
def test_divide():
27+
# assert OtherCalculator.divide(1, 2) == 0.5
28+
assert OtherCalculator.divide(1.0, 2.0) == 0.5
29+
assert OtherCalculator.divide(0, 2.0) == 0
30+
assert OtherCalculator.divide(-4, 2.0) == -2.0
31+
# assert OtherCalculator.divide(2.0, 0.0) == 'Cannot divide by 0'

0 commit comments

Comments
 (0)