def test_asarray_with_illegal_mode_raises_error(): trace = Trace([[0, 0], [1, 5]]) with pytest.raises(ValueError) as excinfo: trace.asarray('wrong mode') assert 'invalid mode' in str(excinfo.value).lower()
def test_asarray(data, mode, expected): trace = Trace(data) actual = trace.asarray(mode) assert isinstance(actual, np.ndarray) np.testing.assert_almost_equal(actual, expected)