GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 0fe454...288929 )
by Anca
21:13
created

test_load.TestLoad.test_folder()   A

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
""" Unit testing module for pre-processing functions """
2
3
import unittest
4
import string
5
6
import crowdtruth
7
from crowdtruth.configuration import DefaultConfig
8
9
TEST_FILE_PREF = "test/test_data/load/"
10
11
class TestConfig(DefaultConfig):
12
    inputColumns = ["input"]
13
    outputColumns = ["Answer.output"]
14
    open_ended_task = False
15
    annotation_separator = " "
16
    annotation_vector = list(string.ascii_uppercase)
17
    def processJudgments(self, judgments):
18
        return judgments
19
20
class TestLoad(unittest.TestCase):
21
    test_conf_const = TestConfig()
22
23
    def test_platform(self):
24
        for w in range(1, 6):
25
            test_config_amt = self.test_conf_const.__class__
26
            data_amt, _ = crowdtruth.load(
27
                file=TEST_FILE_PREF + "platform_amt" + str(w) + ".csv",
28
                config=test_config_amt())
29
            test_config_cf = self.test_conf_const.__class__
30
            data_cf, _ = crowdtruth.load(
31
                file=TEST_FILE_PREF + "platform_cf" + str(w) + ".csv",
32
                config=test_config_cf())
33
            self.assertEqual(
34
                (set(data_cf["units"]["duration"].keys()) -
35
                 set(data_amt["units"]["duration"].keys())),
36
                set([]))
37
            self.assertEqual(
38
                (set(data_cf["workers"]["judgment"].keys()) -
39
                 set(data_amt["workers"]["judgment"].keys())),
40
                set([]))
41
            self.assertEqual(
42
                set(data_cf["workers"]["judgment"] - data_amt["workers"]["judgment"]),
43
                set([0]))
44
45
    def test_folder(self):
46
        test_config = self.test_conf_const.__class__
47
        data, _ = crowdtruth.load(
48
            directory=TEST_FILE_PREF + "dir/",
49
            config=test_config())
50
        self.assertEqual(data["workers"].shape[0], 7)
51
        self.assertEqual(data["units"].shape[0], 2)
52
        self.assertEqual(data["judgments"].shape[0], 12)
53