-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: when using from table to time series feature must be given (#572)
Closes #571 ### Summary of Changes TimeSeries no longer is subclass of TaggedTable only of Table <!-- Please provide a summary of changes in this pull request, ensuring all changes are explained. --> --------- Co-authored-by: megalinter-bot <[email protected]>
- Loading branch information
1 parent
f6a3ca7
commit ca23f0f
Showing
50 changed files
with
486 additions
and
515 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 0 additions & 61 deletions
61
tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_eq.py
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_hash.py
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
tests/safeds/data/tabular/containers/_table/_tagged_table/_time_series/test_sizeof.py
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
}, | ||
"target", | ||
"time", | ||
["feature_1"], | ||
None, | ||
), | ||
), | ||
], | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
100 changes: 100 additions & 0 deletions
100
tests/safeds/data/tabular/containers/_time_series/test_eq.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
from typing import Any | ||
|
||
import pytest | ||
from safeds.data.tabular.containers import Row, Table, TaggedTable, TimeSeries | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("table1", "table2", "expected"), | ||
[ | ||
( | ||
TimeSeries({"a": [], "b": [], "c": []}, "b", "c", ["a"]), | ||
TimeSeries({"a": [], "b": [], "c": []}, "b", "c", ["a"]), | ||
True, | ||
), | ||
( | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), | ||
True, | ||
), | ||
( | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "c", "d", ["a"]), | ||
False, | ||
), | ||
( | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "c", ["a"]), | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "e": [10, 11, 12]}, "b", "c", ["a"]), | ||
False, | ||
), | ||
( | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), | ||
TimeSeries({"a": [1, 1, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), | ||
False, | ||
), | ||
( | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), | ||
TimeSeries({"a": ["1", "2", "3"], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), | ||
False, | ||
), | ||
( | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["c"]), | ||
False, | ||
), | ||
( | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "d", ["a"]), | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9], "d": [10, 11, 12]}, "b", "c", ["a"]), | ||
False, | ||
), | ||
], | ||
ids=[ | ||
"rowless table", | ||
"equal tables", | ||
"different target", | ||
"different column names", | ||
"different values", | ||
"different types", | ||
"different features", | ||
"different time", | ||
], | ||
) | ||
def test_should_return_whether_two_tagged_tables_are_equal( | ||
table1: TimeSeries, | ||
table2: TimeSeries, | ||
expected: bool, | ||
) -> None: | ||
assert (table1.__eq__(table2)) == expected | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"table1", | ||
[TimeSeries({"a": [], "b": [], "c": []}, "b", "c", ["a"])], | ||
ids=[ | ||
"any", | ||
], | ||
) | ||
def test_should_return_true_if_objects_are_identical(table1: TimeSeries) -> None: | ||
assert (table1.__eq__(table1)) is True | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("table", "other"), | ||
[ | ||
(TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), None), | ||
(TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), Row()), | ||
(TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), Table()), | ||
( | ||
TimeSeries({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}, "b", "c", ["a"]), | ||
TaggedTable({"a": [1, 2, 3], "b": [4, 5, 6]}, "b", ["a"]), | ||
), | ||
], | ||
ids=[ | ||
"TimeSeries vs. None", | ||
"TimeSeries vs. Row", | ||
"TimeSeries vs. Table", | ||
"TimeSeries vs. TaggedTable", | ||
], | ||
) | ||
def test_should_return_not_implemented_if_other_is_not_tagged_table(table: TimeSeries, other: Any) -> None: | ||
assert (table.__eq__(other)) is NotImplemented |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.