Ejemplo n.º 1
0
class TestGrade13(unittest.TestCase):
    def setUp(self):
        fname = 'tests/psych_today.txt'
        with open(fname) as f:
            self.data = f.read()
        self.check = Checktext(wlist=None)

    def test_nums(self):
        data, sentences, chars, num_words = self.check.pre_check(self.data)
        self.assertEqual((sentences, chars, num_words), (6, 554, 100))

    def test_raw_data(self):
        unc, uncom_len, uniq_len, dc_score, cli_score = self.check.run_check(self.data)
        self.assertEqual((uncom_len, uniq_len, dc_score, cli_score), (23, 79, 8.4, 15.0))
Ejemplo n.º 2
0
class TestGrade5(unittest.TestCase):
    def setUp(self):
        fname = 'tests/amphib.txt'
        with open(fname) as f:
            self.data = f.read()
        self.check = Checktext(wlist=None)

    def test_nums(self):
        data, sentences, chars, num_words = self.check.pre_check(self.data)
        self.assertEqual((sentences, chars, num_words), (15, 666, 148))

    def test_raw_data(self):
        unc, uncom_len, uniq_len, dc_score, cli_score = self.check.run_check(self.data)
        self.assertEqual((uncom_len, uniq_len, dc_score, cli_score), (23, 94, 7.6, 7.7))
Ejemplo n.º 3
0
class TestGrade1(unittest.TestCase):
    def setUp(self):
        fname = 'tests/frog_toad.txt'
        with open(fname) as f:
            self.data = f.read()
        self.check = Checktext(wlist=None)

    def test_nums(self):
        data, sentences, chars, num_words = self.check.pre_check(self.data)
        self.assertEqual((sentences, chars, num_words), (6, 198, 59))

    def test_raw_data(self):
        unc, uncom_len, uniq_len, dc_score, cli_score = self.check.run_check(self.data)
        self.assertEqual((uncom_len, uniq_len, dc_score, cli_score), (6, 41, 7.1, 0.9))
Ejemplo n.º 4
0
class TestParrot(unittest.TestCase):
    def setUp(self):
        fname = 'tests/parrot.txt'
        with open(fname) as f:
            self.data = f.read()
        self.check = Checktext(wlist=None)

    def test_nums(self):
        data, sentences, chars, num_words = self.check.pre_check(self.data)
        self.assertEqual((sentences, chars, num_words), (82, 2456, 643))

    def test_raw_data(self):
        unc, uncom_len, uniq_len, dc_score, cli_score = self.check.run_check(self.data)
        self.assertEqual((uncom_len, uniq_len, dc_score, cli_score), (114, 312, 10.3, 2.9))
Ejemplo n.º 5
0
 def setUp(self):
     fname = 'tests/psych_today.txt'
     with open(fname) as f:
         self.data = f.read()
     self.check = Checktext(wlist=None)
Ejemplo n.º 6
0
 def test_raw_data(self):
     check = Checktext(wlist=None)
     unc, uncom_len, uniq_len, dc_score, cli_score = check.run_check('small data')
     self.assertEqual((uncom_len, uniq_len, dc_score, cli_score), (0, 2, 0.0, 7.5))
Ejemplo n.º 7
0
 def test_no_data(self):
     check = Checktext(wlist=None)
     with self.assertRaises(SystemExit) as exc:
         check.run_check('')
     self.assertEqual(exc.exception.code, 1)