コード例 #1
0
 def test_replace_space(self, s, expected):
     actual = StrUtils.replace_spaces(s, pattern='%20')
     assert actual == expected
コード例 #2
0
 def test_is_palindrome(self, s, expected):
     actual = StrUtils.is_palindrome(s)
     assert actual is expected
コード例 #3
0
 def test_check_permutation(self, s1, s2, expected):
     actual = StrUtils.is_permutation(s1, s2)
     assert actual is expected
コード例 #4
0
 def test_check_permutation_raise(self, s1, s2):
     with pytest.raises(ArgError):
         StrUtils.is_permutation(s1, s2)
コード例 #5
0
 def test_is_unique_case_sensitive_char(self, s, expected):
     actual = StrUtils.is_unique_char(s, case_sensitive=True)
     assert actual is expected
コード例 #6
0
 def test_is_unique_char_raise(self, s):
     with pytest.raises(ArgError):
         StrUtils.is_unique_char(s)
コード例 #7
0
 def test_is_unique_char(self, s, expected):
     actual = StrUtils.is_unique_char(s)
     assert actual is expected
コード例 #8
0
    def test_to_bytes_str(self, str_, assert_str):
        bytes_str = StrUtils.to_bytes(str_)

        assert isinstance(bytes_str, bytes)
        assert bytes_str == assert_str
コード例 #9
0
    def test_to_utf8_str(self, str_, assert_str):

        utf8_str = StrUtils.to_str(str_)

        assert isinstance(utf8_str, str)
        assert utf8_str == assert_str
コード例 #10
0
 def test_lcs(self, s1, s2, expected):
     actual = StrUtils.lcs(s1, s2)
     assert actual == expected
コード例 #11
0
 def test_substring(self, s, pattern, expected):
     actual = StrUtils.is_substring(s, pattern)
     assert actual == expected