inflab3/smiley_test.py

16 lines
674 B
Python
Raw Normal View History

2023-07-20 22:06:53 +00:00
import unittest
from smiley import smiley_count
class MyTestCase(unittest.TestCase):
def test_smiley(self):
self.assertEqual(smiley_count('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus convallis.'), 0)
self.assertEqual(smiley_count('Lorem ipsum dolor sit amet =-0, consectetur adipiscing elit =-0. Phasellus convallis. =-0'), 3)
self.assertEqual(smiley_count('Lorem ipsum dolor sit amet =- 0, consectetur adipiscing elit =\n-0. Phasellus convallis.\n=-0'), 1)
self.assertEqual(smiley_count(''), 0)
self.assertEqual(smiley_count('=-0=-0=-0=--=0-=-009=-'), 4)
if __name__ == '__main__':
unittest.main()