12345678910111213141516171819202122232425262728293031323334353637 |
- from um import count
- def main():
- test_count_ums()
- test_words_containing_ums()
- test_punctuation()
- test_from_cs50p()
- def test_count_ums():
- assert count("Hello, um, world") == 1
- assert count("Hello um, um, world um") == 3
- assert count("Um Hello, um, world um") == 3
- def test_words_containing_ums():
- assert count("instrumentation") == 0
- assert count("umbrella") == 0
- assert count("momentum") == 0
- def test_punctuation():
- assert count("Hello um?") == 1
- assert count("Hello um!") == 1
- assert count("Hello um") == 1
- assert count("Hello um.") == 1
- def test_from_cs50p():
- assert count("um") == 1
- assert count("um?") == 1
- assert count("Um, thanks for the album.") == 1
- assert count("Um, thanks, um...") == 2
- if __name__ == '__main__':
- main()
|