Skip to content

Commit

Permalink
Merge pull request #121 from etna-team/etna-lib-31
Browse files Browse the repository at this point in the history
Etna lib 31
  • Loading branch information
Alexander76Kuznetsov authored Nov 7, 2023
2 parents 5ea18ee + ee96d32 commit 7375921
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
-

### Changed
-
- Change warning condition on loading object saved under different library version ([#31](https://github.com/etna-team/etna/issues/31))
-
-
-
Expand Down
2 changes: 1 addition & 1 deletion etna/core/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def _validate_metadata(cls, metadata: Dict[str, Any]):
saved_etna_version = tuple(metadata["etna_version"])

# if major version is different give a warning
if current_etna_version[0] != saved_etna_version[0] or current_etna_version[:2] < saved_etna_version[:2]:
if current_etna_version != saved_etna_version:
current_etna_version_str = ".".join([str(x) for x in current_etna_version])
saved_etna_version_str = ".".join([str(x) for x in saved_etna_version])
warnings.warn(
Expand Down
9 changes: 8 additions & 1 deletion tests/test_core/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ def test_save_mixin_load_ok(recwarn, tmp_path):


@pytest.mark.parametrize(
"save_version, load_version", [((1, 5, 0), (2, 5, 0)), ((2, 5, 0), (1, 5, 0)), ((1, 5, 0), (1, 3, 0))]
"save_version, load_version",
[
((1, 5, 0), (2, 5, 0)),
((2, 5, 0), (1, 5, 0)),
((1, 5, 0), (1, 3, 0)),
((1, 5, 0), (1, 5, 1)),
((1, 5, 1), (1, 5, 0)),
],
)
@patch("etna.core.mixins.get_etna_version")
def test_save_mixin_load_warning(get_version_mock, save_version, load_version, tmp_path):
Expand Down
9 changes: 8 additions & 1 deletion tests/test_ensembles/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,14 @@ def test_save_mixin_load_ok_with_ts(example_tsds, recwarn, tmp_path):


@pytest.mark.parametrize(
"save_version, load_version", [((1, 5, 0), (2, 5, 0)), ((2, 5, 0), (1, 5, 0)), ((1, 5, 0), (1, 3, 0))]
"save_version, load_version",
[
((1, 5, 0), (2, 5, 0)),
((2, 5, 0), (1, 5, 0)),
((1, 5, 0), (1, 3, 0)),
((1, 5, 0), (1, 5, 1)),
((1, 5, 1), (1, 5, 0)),
],
)
@patch("etna.core.mixins.get_etna_version")
def test_save_mixin_load_warning(get_version_mock, save_version, load_version, example_tsds, tmp_path):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ def test_load_without_ts(naive_pipeline_with_transforms, recwarn, tmp_path):


@pytest.mark.parametrize(
"save_version, load_version", [((1, 5, 0), (2, 5, 0)), ((2, 5, 0), (1, 5, 0)), ((1, 5, 0), (1, 3, 0))]
"save_version, load_version",
[
((1, 5, 0), (2, 5, 0)),
((2, 5, 0), (1, 5, 0)),
((1, 5, 0), (1, 3, 0)),
((1, 5, 0), (1, 5, 1)),
((1, 5, 1), (1, 5, 0)),
],
)
@patch("etna.core.mixins.get_etna_version")
def test_save_mixin_load_warning(
Expand Down
9 changes: 8 additions & 1 deletion tests/test_models/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,14 @@ def test_save_pf_mixin_with_model_load_ok(recwarn, tmp_path):
],
)
@pytest.mark.parametrize(
"save_version, load_version", [((1, 5, 0), (2, 5, 0)), ((2, 5, 0), (1, 5, 0)), ((1, 5, 0), (1, 3, 0))]
"save_version, load_version",
[
((1, 5, 0), (2, 5, 0)),
((2, 5, 0), (1, 5, 0)),
((1, 5, 0), (1, 3, 0)),
((1, 5, 0), (1, 5, 1)),
((1, 5, 1), (1, 5, 0)),
],
)
@patch("etna.core.mixins.get_etna_version")
def test_save_mixin_load_warning(get_version_mock, save_version, load_version, dummy, tmp_path):
Expand Down
9 changes: 8 additions & 1 deletion tests/test_pipeline/test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,14 @@ def test_save_mixin_load_ok_with_ts(example_tsds, recwarn, tmp_path):


@pytest.mark.parametrize(
"save_version, load_version", [((1, 5, 0), (2, 5, 0)), ((2, 5, 0), (1, 5, 0)), ((1, 5, 0), (1, 3, 0))]
"save_version, load_version",
[
((1, 5, 0), (2, 5, 0)),
((2, 5, 0), (1, 5, 0)),
((1, 5, 0), (1, 3, 0)),
((1, 5, 0), (1, 5, 1)),
((1, 5, 1), (1, 5, 0)),
],
)
@patch("etna.core.mixins.get_etna_version")
def test_save_mixin_load_warning(get_version_mock, save_version, load_version, example_tsds, tmp_path):
Expand Down

0 comments on commit 7375921

Please sign in to comment.