-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.py
More file actions
35 lines (26 loc) · 754 Bytes
/
Copy pathtest.py
File metadata and controls
35 lines (26 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Because infinity needs testing.
from nose.tools import (raises, assert_equal)
import inf
@raises(ZeroDivisionError)
def test_infdiv_zero_zero():
inf.div(0.0, 0.0)
def test_infdiv_normal():
cases = [(1.0, 2.0, 0.5),
(0.0, 2.0, 0.0),
(1, 2, 0.5),
(0, 2, 0.0)]
def one(p, q, expected):
assert_equal(inf.div(p, q), expected)
for p, q, expected in cases:
yield one, p, q, expected
def test_infdiv_infinity():
cases = [
(1.0, 0.0, inf),
(-1.0, 0.0, -inf),
(-1.0, -0.0, inf),
(1.0, -0.0, -inf),
]
def one(p, q, expected):
assert_equal(inf.div(p, q), expected)
for p, q, expected in cases:
yield one, p, q, expected