示例#1
0
def test_time_data_stub_data():
    """Test the data contained in the TimeData stub."""

    time = [1, 0, -1]
    times = [0, .1, .4]

    time_data_stub = stub_utils.time_data_stub(time, times)

    npt.assert_allclose(time_data_stub.time, np.atleast_2d(time))
    npt.assert_allclose(time_data_stub.times, np.atleast_1d(times))
示例#2
0
def test_time_data_stub_slice():
    """Test slicing the TimeData stub."""

    time = [[1, 0, -1], [2, 0, -2]]
    times = [0, .1, .4]

    time_data_stub = stub_utils.time_data_stub(time, times)
    stub_slice = time_data_stub[0]

    npt.assert_allclose(stub_slice.time, np.atleast_2d(time[0]))
    npt.assert_allclose(stub_slice.times, np.atleast_1d(times))
示例#3
0
def time_data_three_points():
    """
    TimeData stub with three data points.

    Returns
    -------
    time_data
        stub of pyfar TimeData class
    """
    time_data = stub_utils.time_data_stub([1, 0, -1], [0, .1, .4])
    return time_data
示例#4
0
def test_time_data_stub_properties():
    """ Test comparing properties of TimeData stub
    with actual TimeData implementation.
    """
    time = [1, 0, -1]
    times = [0, .1, .4]

    time_data_stub = stub_utils.time_data_stub(time, times)
    stub_dir = dir(time_data_stub)
    time_data_dir = dir(TimeData(time, times))

    assert stub_dir.sort() == time_data_dir.sort()