예제 #1
0
    def test_set_gold(self):
        swap = SWAP()
        labels = {0: 1, 1: 1, 2: 0, 3: 0}
        swap.set_gold_labels(labels)

        b = swap.subjects
        for i, g in labels.items():
            assert i in b
            assert b.get(i).gold == g
예제 #2
0
    def test_set_gold_negates(self):
        swap = SWAP()
        subject = Subject(0)
        subject._gold = 1
        swap.subjects.add(subject)

        swap.set_gold_labels({})

        print(type(subject.gold))
        print(subject.gold)
        assert subject.gold == -1
예제 #3
0
    def test_manifest(self):
        swap = SWAP()
        golds = {0: 1, 1: 1, 2: 0, 3: 0}
        swap.set_gold_labels(golds)

        for x in range(10):
            for y in range(10):
                swap.classify(Classification(x, y, 0))
        swap.process_changes()

        print(swap.manifest())
예제 #4
0
    def test_stats(self):
        swap = SWAP()
        golds = {0: 1, 1: 1, 2: 0, 3: 0}
        swap.set_gold_labels(golds)

        for x in range(10):
            for y in range(10):
                swap.classify(Classification(x, y, 0))
        swap.process_changes()

        stats = swap.stats
        print(stats)
        assert type(stats) is Stats
예제 #5
0
    def test_doesnt_override_golds(self):
        swap = SWAP()
        golds = {1: 1, 2: 0, 3: 0}
        swap.set_gold_labels(golds)

        bureau = swap.subjects
        print(bureau)

        cl = Classification(0, 2, 0)
        cl.gold = 1
        swap.classify(cl)
        swap.process_changes()
        print(bureau.get(1))
        assert bureau.get(2).gold == 0
예제 #6
0
    def test_get_gold(self):
        swap = SWAP()
        labels = {0: 1, 1: 1, 2: 0, 3: 0}
        swap.set_gold_labels(labels)

        assert swap.golds == labels