Skip to content

Commit ca3a4d4

Browse files
step4: add more tests
1 parent 8a338c3 commit ca3a4d4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/test_calculator.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from .calculator import Calculator
2+
import time
3+
import random
24

35

46
def test_add():
@@ -29,3 +31,13 @@ def test_divide():
2931
assert Calculator.divide(0, 2.0) == 0
3032
assert Calculator.divide(-4, 2.0) == -2.0
3133
# assert Calculator.divide(2.0, 0.0) == 'Cannot divide by 0'
34+
35+
def test_fail():
36+
assert True == False
37+
38+
def test_flaky():
39+
assert random.random() < 0.8 # This should fail 20% of the time
40+
41+
def test_slow():
42+
time.sleep(5)
43+
assert True == True

0 commit comments

Comments
 (0)