Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

started reworking mixin tests #252

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/base/test_DataFrameMethodTransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import tests.test_data as d
from tests.base_tests import (
ColumnStrListInitTests,
DropOriginalInitTests,
DropOriginalTransformTests,
DropOriginalInitMixinTests,
DropOriginalTransformMixinTests,
GenericFitTests,
GenericTransformTests,
OtherBaseBehaviourTests,
Expand Down Expand Up @@ -86,7 +86,7 @@ def test_exception_raised_non_pandas_method_passed(self):
)


class TestInit(DropOriginalInitTests, DataFrameMethodTransformerInitTests):
class TestInit(DropOriginalInitMixinTests, DataFrameMethodTransformerInitTests):
@classmethod
def setup_class(cls):
cls.transformer_name = "DataFrameMethodTransformer"
Expand All @@ -100,7 +100,7 @@ def setup_class(cls):
cls.transformer_name = "DataFrameMethodTransformer"


class TestTransform(DropOriginalTransformTests, GenericTransformTests):
class TestTransform(DropOriginalTransformMixinTests, GenericTransformTests):
"""Tests for DataFrameMethodTransformer.transform()."""

@classmethod
Expand Down
8 changes: 4 additions & 4 deletions tests/base_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_columns_non_string_or_list_error(
uninitialized_transformers[self.transformer_name](**args)


class DropOriginalInitTests(GenericInitTests):
class DropOriginalInitMixinTests:
"""
Tests for BaseTransformer.init() behaviour specific to when a transformer accepts a "drop_original" column.
Note this deliberately avoids starting with "Tests" so that the tests are not run on import.
Expand All @@ -144,7 +144,7 @@ def test_drop_column_arg_errors(
uninitialized_transformers[self.transformer_name](**args)


class WeightColumnInitTests(GenericInitTests):
class WeightColumnInitMixinTests:
"""
Tests for BaseTransformer.init() behaviour specific to when a transformer takes accepts a weight column.
Note this deliberately avoids starting with "Tests" so that the tests are not run on import.
Expand Down Expand Up @@ -363,7 +363,7 @@ def test_unexpected_kwarg_error(
)


class WeightColumnFitTests(GenericFitTests):
class WeightColumnFitMixinTests:
def test_fit_returns_self_weighted(
self,
minimal_attribute_dict,
Expand Down Expand Up @@ -553,7 +553,7 @@ def test_original_df_not_updated(self, initialized_transformers):
pd.testing.assert_frame_equal(df, d.create_df_3())


class DropOriginalTransformTests(GenericTransformTests):
class DropOriginalTransformMixinTests:
"""
Transform tests for transformers that take a "drop_original" argument
Note this deliberately avoids starting with "Tests" so that the tests are not run on import.
Expand Down
8 changes: 4 additions & 4 deletions tests/capping/test_BaseCappingTransformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
GenericFitTests,
GenericInitTests,
GenericTransformTests,
WeightColumnFitTests,
WeightColumnInitTests,
WeightColumnFitMixinTests,
WeightColumnInitMixinTests,
)
from tubular.capping import BaseCappingTransformer


class GenericCappingInitTests(WeightColumnInitTests, GenericInitTests):
class GenericCappingInitTests(WeightColumnInitMixinTests, GenericInitTests):
"""Tests for BaseCappingTransformer.init()."""

@classmethod
Expand Down Expand Up @@ -229,7 +229,7 @@ def test_capping_value_nan_inf_error(
uninitialized_transformers[self.transformer_name](**args)


class GenericCappingFitTests(WeightColumnFitTests, GenericFitTests):
class GenericCappingFitTests(WeightColumnFitMixinTests, GenericFitTests):
"""Tests for BaseCappingTransformer.fit()."""

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions tests/comparison/test_EqualityChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import tests.test_data as d
from tests.base_tests import (
DropOriginalInitTests,
DropOriginalInitMixinTests,
GenericFitTests,
GenericTransformTests,
OtherBaseBehaviourTests,
Expand All @@ -12,7 +12,7 @@
from tubular.comparison import EqualityChecker


class TestInit(DropOriginalInitTests, TwoColumnListInitTests):
class TestInit(DropOriginalInitMixinTests, TwoColumnListInitTests):
"""Generic tests for transformer.init()."""

@classmethod
Expand Down
8 changes: 4 additions & 4 deletions tests/imputers/test_MeanImputer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
GenericFitTests,
GenericTransformTests,
OtherBaseBehaviourTests,
WeightColumnFitTests,
WeightColumnInitTests,
WeightColumnFitMixinTests,
WeightColumnInitMixinTests,
)
from tests.imputers.test_BaseImputer import (
GenericImputerTransformTests,
Expand All @@ -17,15 +17,15 @@
from tubular.imputers import MeanImputer


class TestInit(WeightColumnInitTests, ColumnStrListInitTests):
class TestInit(WeightColumnInitMixinTests, ColumnStrListInitTests):
"""Generic tests for transformer.init()."""

@classmethod
def setup_class(cls):
cls.transformer_name = "MeanImputer"


class TestFit(WeightColumnFitTests, GenericFitTests):
class TestFit(WeightColumnFitMixinTests, GenericFitTests):
"""Generic tests for transformer.fit()"""

@classmethod
Expand Down
8 changes: 4 additions & 4 deletions tests/imputers/test_MedianImputer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
GenericFitTests,
GenericTransformTests,
OtherBaseBehaviourTests,
WeightColumnFitTests,
WeightColumnInitTests,
WeightColumnFitMixinTests,
WeightColumnInitMixinTests,
)
from tests.imputers.test_BaseImputer import (
GenericImputerTransformTests,
Expand All @@ -18,15 +18,15 @@
from tubular.imputers import MedianImputer


class TestInit(ColumnStrListInitTests, WeightColumnInitTests):
class TestInit(ColumnStrListInitTests, WeightColumnInitMixinTests):
"""Generic tests for transformer.init()."""

@classmethod
def setup_class(cls):
cls.transformer_name = "MedianImputer"


class TestFit(WeightColumnFitTests, GenericFitTests):
class TestFit(WeightColumnFitMixinTests, GenericFitTests):
"""Generic tests for transformer.fit()"""

@classmethod
Expand Down
8 changes: 4 additions & 4 deletions tests/imputers/test_ModeImputer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
GenericFitTests,
GenericTransformTests,
OtherBaseBehaviourTests,
WeightColumnFitTests,
WeightColumnInitTests,
WeightColumnFitMixinTests,
WeightColumnInitMixinTests,
)
from tests.imputers.test_BaseImputer import (
GenericImputerTransformTests,
Expand All @@ -19,15 +19,15 @@
from tubular.imputers import ModeImputer


class TestInit(ColumnStrListInitTests, WeightColumnInitTests):
class TestInit(ColumnStrListInitTests, WeightColumnInitMixinTests):
"""Generic tests for transformer.init()."""

@classmethod
def setup_class(cls):
cls.transformer_name = "ModeImputer"


class TestFit(WeightColumnFitTests, GenericFitTests):
class TestFit(WeightColumnFitMixinTests, GenericFitTests):
"""Generic tests for transformer.fit()"""

@classmethod
Expand Down
Loading