def test_matrix(self): attr = data_types.Matrix([[1, 2, 3], [4, 5, 6]]) assert attr._as_dict() == { "type": "verta.matrix.v1", "matrix": { "value": [[1, 2, 3], [4, 5, 6]], }, }
def test_matrix_numpy(self): np = pytest.importorskip("numpy") attr = data_types.Matrix(np.arange(1, 7).reshape((2, 3))) assert attr._as_dict() == { "type": "verta.matrix.v1", "matrix": { "value": [[1, 2, 3], [4, 5, 6]], }, }
def test_matrix(self): attr = data_types.Matrix([[1, 2, 3], [4, 5, 6]]) d = { "type": "verta.matrix.v1", "matrix": { "value": [[1, 2, 3], [4, 5, 6]], }, } assert attr._as_dict() == d assert attr == data_types._VertaDataType._from_dict(d)