Skip to content

Commit

Permalink
added assertion error unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
Safiya-hash committed Jan 7, 2025
1 parent e367f6c commit 03b0ef6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions solutions/tests/test_string_length.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ def test_spaces_as_string(self):
def test_mixed_characters(self):
"""It should return the correct length for a string with mixed characters."""
self.assertEqual(string_length("Documenting,testing and debugging"), 31)


def test_non_string_values(self):
"""It should return a TypeError with non string values"""
with self.assertRaises(TypeError):
string_length([1, 2, 5.5, 5])

0 comments on commit 03b0ef6

Please sign in to comment.