Skip to content

Commit 75ef745

Browse files
committed
refactor: rename test functions for SlugValueObject for clarity
Signed-off-by: Adria Montoto <75563346+adriamontoto@users.noreply.github.com>
1 parent 9304576 commit 75ef745

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

tests/usables/internet/test_key_value_object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_key_value_object_happy_path() -> None:
1717
key = KeyValueObject(value='abc.123-def.ghi')
1818

1919
assert type(key.value) is str
20-
assert key.value == 'abc.123-def.ghi'
20+
assert key.value == 'abc.123-def.ghi' # gitleaks:allow
2121

2222

2323
# TODO: make it dynamic with object mother

tests/usables/internet/test_slug_value_object.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
# TODO: make it dynamic with object mother
1212
@mark.unit_testing
13-
def test_strict_string_identifier_value_object_happy_path() -> None:
13+
def test_slug_value_object_happy_path() -> None:
1414
"""
1515
Test SlugValueObject value object happy path.
1616
"""
@@ -23,7 +23,7 @@ def test_strict_string_identifier_value_object_happy_path() -> None:
2323
# TODO: make it dynamic with object mother
2424
@mark.unit_testing
2525
@mark.parametrize(argnames='value', argvalues=['abc_123', 'Abc-123', '-abc-123', 'abc--123', 'abc-123-'])
26-
def test_strict_string_identifier_value_object_invalid_characters(value: str) -> None:
26+
def test_slug_value_object_invalid_characters(value: str) -> None:
2727
"""
2828
Test SlugValueObject value object raises ValueError when value has invalid format.
2929
"""
@@ -35,7 +35,7 @@ def test_strict_string_identifier_value_object_invalid_characters(value: str) ->
3535

3636

3737
@mark.unit_testing
38-
def test_strict_string_identifier_value_object_empty_value() -> None:
38+
def test_slug_value_object_empty_value() -> None:
3939
"""
4040
Test SlugValueObject value object raises ValueError when value is empty.
4141
"""
@@ -47,7 +47,7 @@ def test_strict_string_identifier_value_object_empty_value() -> None:
4747

4848

4949
@mark.unit_testing
50-
def test_strict_string_identifier_value_object_not_trimmed() -> None:
50+
def test_slug_value_object_not_trimmed() -> None:
5151
"""
5252
Test SlugValueObject value object raises ValueError when value is not trimmed.
5353
"""
@@ -59,7 +59,7 @@ def test_strict_string_identifier_value_object_not_trimmed() -> None:
5959

6060

6161
@mark.unit_testing
62-
def test_strict_string_identifier_value_object_invalid_type() -> None:
62+
def test_slug_value_object_invalid_type() -> None:
6363
"""
6464
Test SlugValueObject value object raises TypeError when value is not a string.
6565
"""

tests/usables/primitives/integer/test_integer_value_object.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Test IntegerValueObject value object.
33
"""
44

5-
from object_mother_pattern import IntegerMother
5+
from object_mother_pattern import BooleanMother, IntegerMother
66
from pytest import mark, raises as assert_raises
77

88
from value_object_pattern.usables import IntegerValueObject
@@ -28,3 +28,15 @@ def test_integer_value_object_invalid_type() -> None:
2828
match=r'IntegerValueObject value <<<.*>>> must be an integer. Got <<<.*>>> type.',
2929
):
3030
IntegerValueObject(value=IntegerMother.invalid_type())
31+
32+
33+
@mark.unit_testing
34+
def test_integer_value_object_rejects_bool_values() -> None:
35+
"""
36+
Test IntegerValueObject value object raises TypeError when value is a boolean.
37+
"""
38+
with assert_raises(
39+
expected_exception=TypeError,
40+
match=r'IntegerValueObject value <<<.*>>> must be an integer. Got <<<bool>>> type.',
41+
):
42+
IntegerValueObject(value=BooleanMother.create())

0 commit comments

Comments
 (0)