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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
"""
Passing versions of all of the check helper functions.
"""
from pytest_check import check
import math
def test_equal():
check.equal(1, 1)
def test_not_equal():
check.not_equal(1, 2)
def test_is():
x = ["foo"]
y = x
check.is_(x, y)
def test_is_nan():
check.is_nan(math.nan)
def test_is_not_nan():
check.is_not_nan(0)
def test_is_not():
x = ["foo"]
y = ["foo"]
check.is_not(x, y)
def test_is_true():
check.is_true(True)
def test_is_false():
check.is_false(False)
def test_is_none():
a = None
check.is_none(a)
def test_is_not_none():
a = 1
check.is_not_none(a)
def test_is_in():
check.is_in(2, [1, 2, 3])
def test_is_not_in():
check.is_not_in(4, [1, 2, 3])
def test_is_instance():
check.is_instance(1, int)
def test_is_not_instance():
check.is_not_instance(1, str)
def test_almost_equal():
check.almost_equal(1, 1)
check.almost_equal(1, 1.1, abs=0.2)
check.almost_equal(2, 1, rel=1)
def test_not_almost_equal():
check.not_almost_equal(1, 2)
check.not_almost_equal(1, 2.1, abs=0.1)
check.not_almost_equal(3, 1, rel=1)
def test_greater():
check.greater(2, 1)
def test_greater_equal():
check.greater_equal(2, 1)
check.greater_equal(1, 1)
def test_less():
check.less(1, 2)
def test_less_equal():
check.less_equal(1, 2)
check.less_equal(1, 1)
def test_between():
check.between(10, 0, 20)
def test_between_ge():
check.between(10, 0, 20, ge=True)
check.between(0, 0, 20, ge=True)
def test_between_le():
check.between(10, 0, 20, le=True)
check.between(20, 0, 20, le=True)
def test_between_ge_le():
check.between(0, 0, 20, ge=True, le=True)
check.between(10, 0, 20, ge=True, le=True)
check.between(20, 0, 20, ge=True, le=True)
def test_between_equal():
check.between_equal(0, 0, 20)
check.between_equal(10, 0, 20)
check.between_equal(20, 0, 20)
|