Skip to content

Commit a4b12dd

Browse files
committed
Add test case
1 parent f1ee6a4 commit a4b12dd

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

tests/test_strings.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for strings utility functions."""
22

3+
import pandas as pd
34
import src.strings
45

56

@@ -67,14 +68,14 @@ def test_get_space_indices_empty_string():
6768

6869

6970
def test_get_space_indices_not_string():
70-
"""Empty inputs should return None"""
71+
"""Non-string inputs should return None"""
7172
values = [[], (), {}, None, 7, 7.1, ["strings"]]
7273
for val in values:
7374
assert src.strings.get_space_indices(val) is None
7475

7576

76-
def test_add_line_breaks():
77-
"""Array should array"""
77+
def test_add_line_breaks_list():
78+
"""List of strings should list of strings with correct line breaks added"""
7879
input_arr = [
7980
"abcd ef ghijk",
8081
"abcdefgh",
@@ -86,3 +87,18 @@ def test_add_line_breaks():
8687
"abcdef g\nhijklm"
8788
]
8889
assert src.strings.add_line_breaks(input_arr) == output_arr
90+
91+
92+
def test_add_line_breaks_pd_series():
93+
"""Pd.Series of strings should list of strings with correct line breaks added"""
94+
input_arr = pd.Series([
95+
"abcd ef ghijk",
96+
"abcdefgh",
97+
"abcdef g hijklm"
98+
])
99+
output_arr = [
100+
"abcd ef\nghijk",
101+
"abcdefgh",
102+
"abcdef g\nhijklm"
103+
]
104+
assert src.strings.add_line_breaks(input_arr) == output_arr

0 commit comments

Comments
 (0)