Skip to content

Commit

Permalink
Merge pull request #252 from lvgig/feature/edit_mixin_tests
Browse files Browse the repository at this point in the history
started reworking mixin tests
  • Loading branch information
davidhopkinson26 authored May 21, 2024
2 parents 6452e83 + b533644 commit ea6071b
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 26 deletions.
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

0 comments on commit ea6071b

Please sign in to comment.