approx(): Detect type errors earlier.

This commit is contained in:
Kale Kundert
2018-07-31 00:26:35 -07:00
parent ad305e71d7
commit cd2085ee71
2 changed files with 56 additions and 19 deletions

View File

@@ -441,6 +441,13 @@ class TestApprox(object):
["*At index 0 diff: 3 != 4 * {}".format(expected), "=* 1 failed in *="]
)
@pytest.mark.parametrize(
'x', [None, 'string', ['string'], [[1]], {'key': 'string'}, {'key': {'key': 1}}]
)
def test_expected_value_type_error(self, x):
with pytest.raises(TypeError):
approx(x)
@pytest.mark.parametrize(
"op",
[