Example #1
0
class WordCounterFixtureTests(TestCase):
    def setUp(self):
        """Prepare before each test"""
        MOBYDICK_SUMMARY = open('mobydick_summary.txt').read()
        self.text = TextBody(MOBYDICK_SUMMARY)
        self.counter = WordCounter(self.text)

    def test_count_months(self):
        self.assertEqual(self.counter.count_word("months"), 1)

    def test_count_the(self):
        """Count word in a longer text"""
        self.assertEqual(self.counter.count_word("the"), 6)

    def tearDown(self):
        """Clean up after a test has passed or failed."""
        pass
class WordCounterFixtureTests(TestCase):

    def setUp(self):
        """Prepare before each test"""
        MOBYDICK_SUMMARY = open('mobydick_summary.txt').read()
        self.text = TextBody(MOBYDICK_SUMMARY)
        self.counter = WordCounter(self.text)

    def test_count_months(self):
        self.assertEqual(self.counter.count_word("months"), 1)

    def test_count_the(self):
        """Count word in a longer text"""
        self.assertEqual(self.counter.count_word("the"), 6)

    def tearDown(self):
        """Clean up after a test has passed or failed."""
        pass
def test_count_word_complex():
    """Count word in a longer text"""
    text = TextBody(MOBYDICK_SUMMARY)
    counter = WordCounter(text)
    assert_equal(counter.count_word("white"), 2)
def test_count_word_simple():
    """Count word in a short text"""
    text = TextBody("the white white whale")
    counter = WordCounter(text)
    assert_equal(counter.count_word("white"), 2)
Example #5
0
def test_count_word_complex():
    """Count word in a longer text"""
    text = TextBody(MOBYDICK_SUMMARY)
    counter = WordCounter(text)
    assert_equal(counter.count_word("white"), 2)
Example #6
0
def test_count_word_simple():
    """Count word in a short text"""
    text = TextBody("the white white whale")
    counter = WordCounter(text)
    assert_equal(counter.count_word("white"), 2)
 def test_count_word_simple(self):
     """Count a single word"""
     counter = WordCounter(MockText)
     self.assertEqual(counter.count_word("white"), 2)
Example #8
0
 def test_count_word_simple(self):
     """Count a single word"""
     counter = WordCounter(MockText)
     self.assertEqual(counter.count_word("white"), 2)