Skip to content

Commit be40c06

Browse files
authored
Merge pull request #17 from gjbex/development
Development
2 parents c83f537 + e0aad47 commit be40c06

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

source-code/testing/Hypothesis/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ Run with pytest:
1919
```bash
2020
$ pytest --hypothesis-show-statistics
2121
```
22+
23+
For the `points.py` example, run with:
24+
```bash
25+
$ pytest --hypothesis-show-statistics points.py
26+
```

source-code/testing/Hypothesis/points.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,11 @@ def test_distance():
4646
assert math.isclose(p1.distance(p2), 5.0)
4747

4848

49-
@given(x1=st.floats(), y1=st.floats(), x2=st.floats(), y2=st.floats(), x=st.floats(), y=st.floats())
50-
def test_is_on_line(x1: float, y1: float, x2: float, y2: float, x: float, y: float):
49+
@given(x1=st.floats(), y1=st.floats(), x2=st.floats(), y2=st.floats())
50+
def test_is_on_line(x1: float, y1: float, x2: float, y2: float):
5151
p1 = Point(x1, y1)
5252
p2 = Point(x2, y2)
53-
p = Point(x, y)
53+
p = Point((x1 + x2)/2, (y1 + y2)/2)
5454
assert p.is_on_line(p1, p2)
55+
assert p1.is_on_line(p1, p2)
56+
assert p2.is_on_line(p1, p2)

0 commit comments

Comments
 (0)