コード例 #1
0
def test_interp_shoreline_all_shoreline():
    assert_array_equal(_interp_zero_crossings([1.0, 3.0, 5.0], [0, 0, 0], [0]), [3.0])
    assert_array_equal(_interp_zero_crossings([1.0, 3.0, 5.0], [0, 0, 0], [1]), [5.0])
    assert_array_equal(
        _interp_zero_crossings([1.0, 3.0, 5.0], [0, 0, 0], [0, 1]), [3.0, 5.0]
    )
コード例 #2
0
def test_interp_zero_crossings_last_element():
    with pytest.raises(ValueError):
        _interp_zero_crossings([1.0, 3.0, 5.0], [1, 1, 0], [2])
コード例 #3
0
def test_interp_zero_crossings_on_end_point():
    assert_array_equal(_interp_zero_crossings([1.0, 3.0, 5.0], [1, 0, -1], [1]), [3.0])
    assert_array_equal(_interp_zero_crossings([1.0, 3.0, 5.0], [1, 0, -1], [0]), [3.0])
コード例 #4
0
def test_interp_zero_crossings_bounds_error(shoreline):
    with pytest.raises(ValueError):
        _interp_zero_crossings([1.0, 3.0, 5.0], [1, 2, 3], [shoreline])
コード例 #5
0
def test_interp_zero_crossings():
    assert_array_equal(_interp_zero_crossings([0, 1, 2], [1, -1, -1], [0]), [0.5])
    assert_array_equal(
        _interp_zero_crossings([0, 1, 2, 3], [1, -1, -1, 4], [0, 2]), [0.5, 2.2]
    )