Queer European MD passionate about IT

test_um.py 781 B

12345678910111213141516171819202122232425262728293031323334353637
  1. from um import count
  2. def main():
  3. test_count_ums()
  4. test_words_containing_ums()
  5. test_punctuation()
  6. test_from_cs50p()
  7. def test_count_ums():
  8. assert count("Hello, um, world") == 1
  9. assert count("Hello um, um, world um") == 3
  10. assert count("Um Hello, um, world um") == 3
  11. def test_words_containing_ums():
  12. assert count("instrumentation") == 0
  13. assert count("umbrella") == 0
  14. assert count("momentum") == 0
  15. def test_punctuation():
  16. assert count("Hello um?") == 1
  17. assert count("Hello um!") == 1
  18. assert count("Hello um") == 1
  19. assert count("Hello um.") == 1
  20. def test_from_cs50p():
  21. assert count("um") == 1
  22. assert count("um?") == 1
  23. assert count("Um, thanks for the album.") == 1
  24. assert count("Um, thanks, um...") == 2
  25. if __name__ == '__main__':
  26. main()