Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tschm committed Dec 22, 2023
1 parent 3a35888 commit 8d877ae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_dataclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@

import numpy as np
import pandas as pd
import polars as pl

from cvx.bson.dataclass import Data


@dataclass(frozen=True)
class Maffay(Data):
x: pd.DataFrame
y: pd.DataFrame
y: pl.DataFrame
z: np.array


def test_conversion(tmp_path):
matrix = np.random.rand(5, 2)

x = pd.DataFrame(data=matrix)
y = pd.DataFrame(data=2 * matrix)
y = pl.DataFrame(data=2 * matrix)
z = matrix

data = Maffay(x=x, y=y, z=z)
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def assert_equal(obj1, obj2):
if isinstance(obj1, np.ndarray):
np.testing.assert_array_equal(obj1, obj2)

if isinstance(obj1, pl.DataFrame):
assert obj1.equals(obj2)


def test_roundtrip(data):
"""
Expand Down

0 comments on commit 8d877ae

Please sign in to comment.