当前位置: 首页>>代码示例>>Python>>正文


Python solution.count_substrings函数代码示例

本文整理汇总了Python中solution.count_substrings函数的典型用法代码示例。如果您正苦于以下问题:Python count_substrings函数的具体用法?Python count_substrings怎么用?Python count_substrings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了count_substrings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_with_longer_strings

 def test_with_longer_strings(self):
     self.assertEqual(solution.count_substrings('either kill or be killed',
                                                'kill'),
                      2)
     self.assertEqual(solution.count_substrings("a beard doesn't make one" +
                                                " a philosopher",
                                                "yeaaap"),
                      0)
开发者ID:gshopov,项目名称:the-stash,代码行数:8,代码来源:test.py

示例2: test_count_substrings

 def test_count_substrings(self):
     self.assertEqual(2, count_substrings("This is a test string", "is"))
 # 2
     self.assertEqual(2, count_substrings("babababa", "baba"))
     # 2
     self.assertEqual(
         4, count_substrings("Python is an awesome language to program in!", "o"))
     # 4
     self.assertEqual(
         0, count_substrings("We have nothing in common!", "really?"))
     # 0
     self.assertEqual(
         2, count_substrings("This is this and that is this", "this"))
开发者ID:fyllmax,项目名称:Programming101,代码行数:13,代码来源:test.py

示例3: test_count_substrings

 def test_count_substrings(self):
     self.assertEqual(2, solution.count_substrings("This is a test string", "is"))
     self.assertEqual(4, solution.count_substrings("Python is an awesome language to program in!", "o"))
开发者ID:IvanVK,项目名称:HackBulgaria-Programming101,代码行数:3,代码来源:test.py

示例4: test_with_two_digit_substring

 def test_with_two_digit_substring(self):
     self.assertEqual(2, solution.count_substrings("This is a test string", "is"))
开发者ID:snejy,项目名称:Programming101,代码行数:2,代码来源:tests.py

示例5: test_with_no_matches

 def test_with_no_matches(self):
     self.assertEqual(0, solution.count_substrings("We have nothing in common!", "really?"))
开发者ID:snejy,项目名称:Programming101,代码行数:2,代码来源:tests.py

示例6: test_two

 def test_two(self):
     self.assertEqual(2, count_substrings("babababa", "baba"))
开发者ID:TsvetaKandilarova,项目名称:Programming101,代码行数:2,代码来源:tests.py

示例7: test_five

 def test_five(self):
     self.assertEqual(2, count_substrings("This is this and that is this", "this"))
开发者ID:TsvetaKandilarova,项目名称:Programming101,代码行数:2,代码来源:tests.py

示例8: test_three

 def test_three(self):
     self.assertEqual(4, count_substrings("Python is an awesome language to program in!", "o"))
开发者ID:TsvetaKandilarova,项目名称:Programming101,代码行数:2,代码来源:tests.py

示例9: test_capital_letters

 def test_capital_letters(self):
     self.assertTrue(solution.count_substrings("This is this and that is this", "this"))
开发者ID:pepi09,项目名称:HackBulgaria-Programming101,代码行数:2,代码来源:tests.py

示例10: testing_count_substring2

 def testing_count_substring2(self):
     self.assertEqual(2, count_substrings("babababa", "baba"))
开发者ID:egzheleva,项目名称:HackBulgariaPython,代码行数:2,代码来源:tests.py

示例11: test_with_single_character_strings

 def test_with_single_character_strings(self):
     self.assertEqual(solution.count_substrings('ala bala portokala', 'a'),
                      6)
     self.assertEqual(solution.count_substrings('yo', 'w'), 0)
开发者ID:gshopov,项目名称:the-stash,代码行数:4,代码来源:test.py

示例12: test_does_not_count_overlapped_strings

 def test_does_not_count_overlapped_strings(self):
     self.assertEqual(solution.count_substrings('hahahahahahahahaha', 'ha'),
                      9)
开发者ID:gshopov,项目名称:the-stash,代码行数:3,代码来源:test.py

示例13: test_takes_case_into_consideration

 def test_takes_case_into_consideration(self):
     self.assertEqual(solution.count_substrings("This ain't this!", 'this'),
                      1)
开发者ID:gshopov,项目名称:the-stash,代码行数:3,代码来源:test.py

示例14: test_count_substrings_3rd

	def test_count_substrings_3rd(self):
		self.assertEqual(4, solution.count_substrings("Python is an awesome language to program in!", "o"))
开发者ID:jorjich,项目名称:HackBulgaria-Programming101,代码行数:2,代码来源:tests.py

示例15: test_contains_string

 def test_contains_string(self):
     self.assertTrue(solution.count_substrings("This is a test string", "is"))
开发者ID:pepi09,项目名称:HackBulgaria-Programming101,代码行数:2,代码来源:tests.py


注:本文中的solution.count_substrings函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。