-
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.
test: move new method to another file since it's unrelated to test re…
…sources
- Loading branch information
1 parent
cf6abba
commit 2a670cb
Showing
4 changed files
with
28 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from ._assertions import assert_that_tables_are_close | ||
from ._resources import resolve_resource_path | ||
|
||
__all__ = ["resolve_resource_path"] | ||
__all__ = ["assert_that_tables_are_close", "resolve_resource_path"] |
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,24 @@ | ||
import pytest | ||
from safeds.data.tabular.containers import Table | ||
|
||
|
||
def assert_that_tables_are_close(table1: Table, table2: Table) -> None: | ||
""" | ||
Assert that two tables are almost equal. | ||
Parameters | ||
---------- | ||
table1: Table | ||
The first table. | ||
table2: Table | ||
The table to compare the first table to. | ||
""" | ||
assert table1.schema == table2.schema | ||
for column_name in table1.column_names: | ||
assert table1.get_column(column_name).type == table2.get_column(column_name).type | ||
assert table1.get_column(column_name).type.is_numeric() | ||
assert table2.get_column(column_name).type.is_numeric() | ||
for i in range(table1.number_of_rows): | ||
entry_1 = table1.get_column(column_name).get_value(i) | ||
entry_2 = table2.get_column(column_name).get_value(i) | ||
assert entry_1 == pytest.approx(entry_2) |
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
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