Skip to content

Commit

Permalink
feat(tests): update test_functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pehlicd committed Mar 18, 2024
1 parent 7668795 commit 77f30d8
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,56 +32,68 @@
("empty list", [], False),
],
)

def test_functions_diff(test_description, given, expected):
assert (
functions.diff(given) == expected
), f"{test_description}: Expected {given} to return {expected}"


def test_keep_len_function():
"""
Test the len function
"""
assert functions.len([1, 2, 3]) == 3


def test_keep_all_function():
"""
Test the all function
"""
assert functions.all([1, 1, 1]) == True
assert functions.all([1, 1, 0]) == False


def test_keep_diff_function():
"""
Test the diff function
"""
assert functions.diff([1, 1, 1]) == False
assert functions.diff([1, 1, 0]) == True


def test_keep_split_function():
"""
Test the split function
"""
assert functions.split("a,b,c", ",") == ["a", "b", "c"]
assert functions.split("a|b|c", "|") == ["a", "b", "c"]

def test_keep_uppercase_function():
"""
Test the uppercase function
"""
assert functions.uppercase("a") == "A"

def test_keep_lowercase_function():
"""
Test the lowercase function
"""
assert functions.lowercase("A") == "a"

def test_keep_strip_function():
"""
Test the strip function
"""
assert functions.strip(" a ") == "a"


def test_keep_first_function():
"""
Test the first function
"""
assert functions.first([1, 2, 3]) == 1

def test_keep_last_function():
"""
Test the last function
"""
assert functions.last([1, 2, 3]) == 3

def test_keep_utcnow_function():
"""
Expand All @@ -91,7 +103,6 @@ def test_keep_utcnow_function():
assert isinstance(dt.tzinfo, type(datetime.timezone.utc))
assert isinstance(dt, datetime.datetime)


def test_keep_to_utc_function():
"""
Test the to_utc function
Expand All @@ -103,7 +114,6 @@ def test_keep_to_utc_function():
now_utc = functions.to_utc(now)
assert now_utc.tzinfo == pytz.utc


def test_keep_datetime_compare_function():
"""
Test the datetime_compare function
Expand All @@ -114,7 +124,6 @@ def test_keep_datetime_compare_function():
assert int(functions.datetime_compare(dt2, dt1)) == 1
assert int(functions.datetime_compare(dt1, dt1)) == 0


def test_keep_encode_function():
"""
Test the encode function
Expand Down

0 comments on commit 77f30d8

Please sign in to comment.