Skip to content

Commit 3469d66

Browse files
committed
Remove @overload and add new test
1 parent 8c72011 commit 3469d66

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

integration_tests/test_str_01.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,41 @@ def test_str_slice():
3838
# assert a[0:5:-1] == ""
3939

4040
def test_str_isalpha():
41-
a:str = "helloworld"
42-
b:str = "hj kl"
41+
a: str = "helloworld"
42+
b: str = "hj kl"
43+
c: str = "a12(){}A"
4344
res: bool = a.isalpha()
4445
res2: bool = b.isalpha()
46+
res3: bool = c.isalpha()
4547
assert res == True
4648
assert res2 == False
49+
assert res3 == False
50+
4751

4852
def test_str_title():
49-
a:str = "hello world"
50-
b:str = "hj'kl"
53+
a: str = "hello world"
54+
b: str = "hj'kl"
55+
c: str = "hELlo wOrlD"
56+
d: str = "{Hel1o}world"
5157
res: str = a.title()
5258
res2: str = b.title()
59+
res3: str = c.title()
60+
res4: str = d.title()
5361
assert res == "Hello World"
5462
assert res2 == "Hj'Kl"
63+
assert res3 == "Hello World"
64+
assert res4 == "{Hel1O}World"
5565

5666
def test_str_istitle():
57-
a:str = "Hello World"
58-
b:str = "Hj'kl"
67+
a: str = "Hello World"
68+
b: str = "Hj'kl"
69+
c: str = "hELlo wOrlD"
5970
res: bool = a.istitle()
6071
res2: bool = b.istitle()
72+
res3: bool = c.istitle()
6173
assert res == True
6274
assert res2 == False
75+
assert res3 == False
6376

6477
def test_str_repeat():
6578
a: str

src/runtime/lpython_builtin.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,6 @@ def _lpython_str_join(s:str, lis:list[str]) -> str:
685685
res += s + lis[i]
686686
return res
687687

688-
@overload
689688
def _lpython_str_isalpha(s: str) -> bool:
690689
ch: str
691690
for ch in s:
@@ -697,7 +696,6 @@ def _lpython_str_isalpha(s: str) -> bool:
697696
return False
698697
return True
699698

700-
@overload
701699
def _lpython_str_title(s: str) -> str:
702700
result: str = ""
703701
capitalize_next: bool = True
@@ -722,7 +720,6 @@ def _lpython_str_title(s: str) -> str:
722720

723721
return result
724722

725-
@overload
726723
def _lpython_str_istitle(s: str) -> bool:
727724
length: i32 = len(s)
728725

0 commit comments

Comments
 (0)