Skip to content

Commit

Permalink
add some more serializer tests for objects
Browse files Browse the repository at this point in the history
  • Loading branch information
hollandjg committed Jan 22, 2024
1 parent 16ec1cc commit 6111484
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tests/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,43 @@

import pandas as pd
from hypothesis import Verbosity, given, settings
from pandas import DataFrame

from autora.state import StandardState
from autora.variable import Variable, VariableCollection

from .test_serializer import serializer_dump_load_strategy
from .test_strategies import standard_state_strategy
from .test_strategies import (
dataframe_strategy,
standard_state_strategy,
variable_strategy,
variablecollection_strategy,
)

logger = logging.getLogger(__name__)


@given(variable_strategy(), serializer_dump_load_strategy)
@settings(verbosity=Verbosity.verbose)
def test_variable_serialize_deserialize(o: Variable, dump_load):
o_loaded = dump_load(o)
assert o == o_loaded


@given(variablecollection_strategy(), serializer_dump_load_strategy)
@settings(verbosity=Verbosity.verbose)
def test_variablecollection_serialize_deserialize(o: VariableCollection, dump_load):
o_loaded = dump_load(o)
assert o == o_loaded


@given(dataframe_strategy(), serializer_dump_load_strategy)
@settings(verbosity=Verbosity.verbose)
def test_dataframe_serialize_deserialize(o: DataFrame, dump_load):
o_loaded = dump_load(o)
o.equals(o_loaded)


@given(standard_state_strategy(), serializer_dump_load_strategy)
@settings(verbosity=Verbosity.verbose)
def test_state_serialize_deserialize(o: StandardState, dump_load):
Expand Down

0 comments on commit 6111484

Please sign in to comment.