-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_.py
40 lines (25 loc) · 1.06 KB
/
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
import unittest
import anonymize_data
import bayesian_goty
import compute_bayesian_rating
import schulze_goty
class TestAnonymizeDataMethods(unittest.TestCase):
def test_anonymize(self):
example_filename = 'data/anonymized_votes/steam_resetera_2017_goty_votes.csv'
file_encoding = 'cp1252'
data = bayesian_goty.load_input(example_filename, file_encoding)
# Assumption: the name of the author appears as the first token on each line of data
author_name_token_index = 0
anonymized_data = anonymize_data.anonymize(data, author_name_token_index)
self.assertGreater(len(anonymized_data), 0)
class TestComputeBayesianRatingMethods(unittest.TestCase):
def test_main(self):
self.assertTrue(compute_bayesian_rating.main())
class TestBayesianGotyMethods(unittest.TestCase):
def test_main(self):
self.assertTrue(bayesian_goty.main())
class TestSchulzeGotyMethods(unittest.TestCase):
def test_main(self):
self.assertTrue(schulze_goty.main())
if __name__ == '__main__':
unittest.main()