@@ -20,11 +20,13 @@ def eq(x: str) -> int:
2020 return 2
2121def match(x: str, y: str) -> Tuple[bool, bool]:
2222 return (x.startswith(y), x.endswith(y))
23+ def match_tuple(x: str, y: Tuple[str, ...]) -> Tuple[bool, bool]:
24+ return (x.startswith(y), x.endswith(y))
2325def remove_prefix_suffix(x: str, y: str) -> Tuple[str, str]:
2426 return (x.removeprefix(y), x.removesuffix(y))
2527
2628[file driver.py]
27- from native import f, g, tostr, booltostr, concat, eq, match, remove_prefix_suffix
29+ from native import f, g, tostr, booltostr, concat, eq, match, match_tuple, remove_prefix_suffix
2830import sys
2931
3032assert f() == 'some string'
@@ -45,6 +47,10 @@ assert match('abc', '') == (True, True)
4547assert match('abc', 'a') == (True, False)
4648assert match('abc', 'c') == (False, True)
4749assert match('', 'abc') == (False, False)
50+ assert match_tuple('abc', ('d', 'e')) == (False, False)
51+ assert match_tuple('abc', ('a', 'c')) == (True, True)
52+ assert match_tuple('abc', ('a',)) == (True, False)
53+ assert match_tuple('abc', ('c',)) == (False, True)
4854
4955assert remove_prefix_suffix('', '') == ('', '')
5056assert remove_prefix_suffix('abc', 'a') == ('bc', 'abc')
0 commit comments