4
4
5
5
import unittest
6
6
7
- from src .basic .string import extract_alphanumeric , reverse_string
7
+ from src .basic .string import (
8
+ extract_alphanumeric ,
9
+ reverse_string ,
10
+ reverse_string_builtin ,
11
+ )
8
12
9
13
10
14
class TestString (unittest .TestCase ):
@@ -31,6 +35,27 @@ def test_reverse_string_with_spaces(self):
31
35
"""Test for string with spaces"""
32
36
self .assertEqual (reverse_string ("hello world" ), "dlrow olleh" )
33
37
38
+ def test_reverse_string_builtin_basic (self ):
39
+ """Test for basic string reversal using built-in function"""
40
+ self .assertEqual (reverse_string_builtin ("hello" ), "olleh" )
41
+ self .assertEqual (reverse_string_builtin ("python" ), "nohtyp" )
42
+
43
+ def test_reverse_string_builtin_empty (self ):
44
+ """Test for empty string using built-in function"""
45
+ self .assertEqual (reverse_string_builtin ("" ), "" )
46
+
47
+ def test_reverse_string_builtin_single_char (self ):
48
+ """Test for single character string using built-in function"""
49
+ self .assertEqual (reverse_string_builtin ("a" ), "a" )
50
+
51
+ def test_reverse_string_builtin_japanese (self ):
52
+ """Test for Japanese string using built-in function"""
53
+ self .assertEqual (reverse_string_builtin ("こんにちは" ), "はちにんこ" )
54
+
55
+ def test_reverse_string_builtin_with_spaces (self ):
56
+ """Test for string with spaces using built-in function"""
57
+ self .assertEqual (reverse_string_builtin ("hello world" ), "dlrow olleh" )
58
+
34
59
def test_extract_alphanumeric_basic (self ):
35
60
"""Test for basic alphanumeric extraction"""
36
61
self .assertEqual (extract_alphanumeric ("Hello123" ), "Hello123" )
0 commit comments