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

feat: string operations on cells #791

Merged
merged 49 commits into from
May 19, 2024
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
49b4401
feat: namespace for string operations on cells
lars-reimann May 18, 2024
1049033
feat: `starts_with` and `ends_with`
lars-reimann May 18, 2024
773789c
feat: `length`
lars-reimann May 18, 2024
7242f06
feat: `to_lowercase` and `to_uppercase`
lars-reimann May 18, 2024
1423d14
feat: `trim`, `trim_start`, `trim_end`
lars-reimann May 18, 2024
9591561
docs: minor improvements
lars-reimann May 18, 2024
6ed16c0
refactor: make metrics classes abstract
lars-reimann May 19, 2024
6b7fac6
docs: normalize result names of plot methods
lars-reimann May 19, 2024
b96d9e6
docs: rename variable in example
lars-reimann May 19, 2024
ea95caa
docs: note that regressors must be fitted before using metrics methods
lars-reimann May 19, 2024
6dbdce2
feat: property access to parameters of label and one-hot encoder
lars-reimann May 19, 2024
541b1db
docs: document the class, not the `__init__`
lars-reimann May 19, 2024
cdfdbbb
test: refactor helper for cell tests
lars-reimann May 19, 2024
1e9036b
test: `Cell.abs`
lars-reimann May 19, 2024
bd0d172
test: `Cell.neg`
lars-reimann May 19, 2024
b8f9c95
test: `+Cell`
lars-reimann May 19, 2024
fc391da
test: `Cell.floor`
lars-reimann May 19, 2024
cdc11d7
test: `Cell.ceil`
lars-reimann May 19, 2024
fb76608
test: `Cell.not_`
lars-reimann May 19, 2024
03e36c1
test: `Cell.and_`
lars-reimann May 19, 2024
a1dba01
test: `Cell.or_`
lars-reimann May 19, 2024
3e6a0d5
test: `Cell.xor`
lars-reimann May 19, 2024
33eb5f2
test: `Cell.add`
lars-reimann May 19, 2024
74ff41b
test: `Cell.sub`
lars-reimann May 19, 2024
c0d7875
test: `Cell.mul`
lars-reimann May 19, 2024
62fe85f
test: `Cell.div`
lars-reimann May 19, 2024
eaea032
test: `Cell.__floordiv__`
lars-reimann May 19, 2024
4b8f287
test: `Cell.eq`
lars-reimann May 19, 2024
06a9714
test: `Cell.ne`
lars-reimann May 19, 2024
6baedcf
test: `Cell.ge`
lars-reimann May 19, 2024
7ac41ef
test: `Cell.lt`
lars-reimann May 19, 2024
267e2af
test: `Cell.le`
lars-reimann May 19, 2024
59018cd
test: `Cell.mod`
lars-reimann May 19, 2024
bbd86e6
test: `Cell.pow`
lars-reimann May 19, 2024
38d3a3d
test: better way to test inverted dunder methods
lars-reimann May 19, 2024
8a5a25f
test: `Cell.__sizeof__`
lars-reimann May 19, 2024
ccc5463
test: `Cell._equals`
lars-reimann May 19, 2024
011736d
test: `Cell._hash`
lars-reimann May 19, 2024
9a2a4a5
test: simplify test of `Column.__hash__`
lars-reimann May 19, 2024
53aa165
feat: `StringCell.index_of`
lars-reimann May 19, 2024
3e38a9e
feat: `StringCell.to_float` and `StringCell.to_int`
lars-reimann May 19, 2024
f64d120
feat: `StringCell.to_date` and `StringCell.to_datetime`
lars-reimann May 19, 2024
4102a54
test: `StringCell._equals`, `StringCell.__hash__`, `StringCell.__size…
lars-reimann May 19, 2024
d73aef2
feat: `StringCell.replace`, `StringCell.substring`
lars-reimann May 19, 2024
6c4a360
feat: rename `string` to `str`
lars-reimann May 19, 2024
e35c755
docs: fix example output
lars-reimann May 19, 2024
2cce126
style: fix ruff error
lars-reimann May 19, 2024
3ec0096
style: fix mypy errors
lars-reimann May 19, 2024
c5479e9
style: apply automated linter fixes
megalinter-bot May 19, 2024
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
Prev Previous commit
Next Next commit
test: Cell.eq
lars-reimann committed May 19, 2024

Verified

This commit was signed with the committer’s verified signature.
lars-reimann Lars Reimann
commit 4b8f287d09dc17ac236cc79c5a94a340d3174a82
29 changes: 29 additions & 0 deletions tests/safeds/data/tabular/containers/_cell/test_eq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pytest

from tests.helpers import assert_cell_operation_works


@pytest.mark.parametrize(
("value1", "value2", "expected"),
[
(3, 3, True),
(3, 1.5, False),
(1.5, 3, False),
(1.5, 1.5, True),
],
ids=[
"int - int",
"int - float",
"float - int",
"float - float",
],
)
class TestShouldComputeEquality:
def test_dunder_method(self, value1: float, value2: float, expected: bool):
assert_cell_operation_works(value1, lambda cell: cell == value2, expected)

def test_dunder_method_inverted_order(self, value1: float, value2: float, expected: bool):
assert_cell_operation_works(value1, lambda cell: value2 == cell, expected)

def test_named_method(self, value1: float, value2: float, expected: bool):
assert_cell_operation_works(value1, lambda cell: cell.eq(value2), expected)