Пример #1
0
def assert_vertex_value_equals_pandas(vertex: Vertex, expected_type: Type,
                                      pandas: pandas_types) -> None:
    get_value = vertex.get_value()
    expected_value = pandas.values.astype(expected_type).reshape(
        get_value.shape)
    assert np.array_equal(get_value, expected_value)
    assert np.issubdtype(get_value.dtype, expected_type)
Пример #2
0
def assert_vertex_value_equals_scalar(vertex: Vertex, expected_type: Type,
                                      scalar: primitive_types) -> None:
    vertex_value = vertex.get_value()
    assert vertex_value == scalar
    assert type(vertex_value) == numpy_types
    assert vertex_value.shape == ()
    assert vertex_value.dtype == expected_type
Пример #3
0
def assert_vertex_value_equals_ndarray(vertex: Vertex, expected_type: Type,
                                       ndarray: numpy_types) -> None:
    vertex_value = vertex.get_value()
    expected_value = ndarray.astype(expected_type)
    assert np.array_equal(vertex_value, expected_value)
    assert np.issubdtype(vertex_value.dtype, expected_type)