diff --git a/test_classes.py b/test_classes.py index 585faf6..fee5e13 100644 --- a/test_classes.py +++ b/test_classes.py @@ -60,6 +60,13 @@ class B(A): class TestWordCounter(unittest.TestCase): @unittest.skip("implement WordCounter") + def test_word_counter_initialisation(self): + word_counter = WordCounter() + + self.assertEquals(word_counter.count(), 0) + + + @unittest.skip("implement counting words") def test_word_counter_count(self): word_counter = WordCounter() word_counter.add_word("polly") @@ -70,7 +77,7 @@ def test_word_counter_count(self): self.assertEquals(word_counter.count(word="parrot"), 1) @unittest.skip("check that the count tracks dupes correctly") - def test_word_counter(self): + def test_word_counter_duplication(self): word_counter = WordCounter() for i in range(3): @@ -79,6 +86,16 @@ def test_word_counter(self): self.assertEquals(word_counter.count(), 3) self.assertEquals(word_counter.count(word="spam"), 3) + @unittest.skip("implement words that haven't been seen") + def test_word_counter_unknown_word(self): + word_counter = WordCounter() + + word_counter.add_word("hello") + word_counter.add_word("world") + + self.assertEquals(word_counter.count("goodbye"), 0) + + class TestCapiClient(unittest.TestCase): # CAPI has two endpoints: /search and /content_id # Each endpoint takes common parameters: page-size, api-key diff --git a/test_regexps.py b/test_regexps.py index 522ac17..e81654f 100644 --- a/test_regexps.py +++ b/test_regexps.py @@ -17,7 +17,7 @@ def test_raw_strings(self): def test_patterns(self): s = "dead parrot" - pattern = re.compile('(dead)') + pattern = re.compile(r'(dead)') self.assertIsNotNone(pattern.match(s)) self.assertIsNotNone(re.match(r'(dead)', s))