def setUp(self):
        from simple import StatsTable

        self.stats = StatsTable(CORPUS)
 def setUp(self):
     from simple import StatsTable
     self.stats = StatsTable(CORPUS)
class TestStatsTable(unittest.TestCase):
    def setUp(self):
        from simple import StatsTable

        self.stats = StatsTable(CORPUS)

    def test_counts(self):
        self.assertEqual(1, self.stats.count("quick"))
        self.assertEqual(2, self.stats.count("the"))
        self.assertEqual(2, self.stats.count("The"))
        self.assertEqual(2.0 / 9, self.stats.frequency("the"))
        self.assertAlmostEqual(0.1102, self.stats.stddev(), places=4)

    def test_add(self):
        self.assertEqual(1, self.stats.count("quick"))
        self.stats.add("quick")
        self.assertEqual(2, self.stats.count("quick"))
        self.stats.add("quick")
        self.assertEqual(3, self.stats.count("quick"))

    def test_reset(self):
        self.assertEqual(1, self.stats.count("quick"))
        self.stats.add("quick")
        self.assertEqual(2, self.stats.count("quick"))
        self.stats.reset(CORPUS)
        self.assertEqual(1, self.stats.count("quick"))
class TestStatsTable(unittest.TestCase):
    def setUp(self):
        from simple import StatsTable
        self.stats = StatsTable(CORPUS)

    def test_counts(self):
        self.assertEqual(1, self.stats.count('quick'))
        self.assertEqual(2, self.stats.count('the'))
        self.assertEqual(2, self.stats.count('The'))
        self.assertEqual(2.0 / 9, self.stats.frequency('the'))
        self.assertAlmostEqual(.1102, self.stats.stddev(), places=4)

    def test_add(self):
        self.assertEqual(1, self.stats.count('quick'))
        self.stats.add('quick')
        self.assertEqual(2, self.stats.count('quick'))
        self.stats.add('quick')
        self.assertEqual(3, self.stats.count('quick'))

    def test_reset(self):
        self.assertEqual(1, self.stats.count('quick'))
        self.stats.add('quick')
        self.assertEqual(2, self.stats.count('quick'))
        self.stats.reset(CORPUS)
        self.assertEqual(1, self.stats.count('quick'))