-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstring_methods_test.py
46 lines (36 loc) · 1.7 KB
/
string_methods_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import unittest
import pytest
from string_methods import (capitalize_title,
check_sentence_ending,
clean_up_spacing,
replace_word_choice)
class LittleSistersEssayTest(unittest.TestCase):
@pytest.mark.task(taskno=1)
def test_capitalize_word(self):
self.assertEqual(capitalize_title("canopy"), "Canopy")
@pytest.mark.task(taskno=1)
def test_capitalize_title(self):
self.assertEqual(capitalize_title("fish are cold blooded"),
"Fish Are Cold Blooded")
@pytest.mark.task(taskno=2)
def test_sentence_ending(self):
self.assertEqual(check_sentence_ending("Snails can sleep for 3 years."), True)
@pytest.mark.task(taskno=2)
def test_sentence_ending_without_period(self):
self.assertEqual(check_sentence_ending("Fittonia are nice"), False)
@pytest.mark.task(taskno=3)
def test_remove_extra_spaces_only_start(self):
self.assertEqual(clean_up_spacing(" A rolling stone gathers no moss"),
"A rolling stone gathers no moss")
@pytest.mark.task(taskno=3)
def test_remove_extra_spaces(self):
self.assertEqual(clean_up_spacing(" Elephants can't jump. "),
"Elephants can't jump.")
@pytest.mark.task(taskno=4)
def test_replace_word_choice(self):
self.assertEqual(replace_word_choice("Animals are cool.", "cool", "awesome"),
"Animals are awesome.")
@pytest.mark.task(taskno=4)
def test_replace_word_not_exist(self):
self.assertEqual(replace_word_choice("Animals are cool.", "small", "tiny"),
"Animals are cool.")