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())
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
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
def test_classify_subject(self): swap = SWAP() u = User(1) s = Subject(2) s._gold = 1 u.classify = MagicMock() s.classify = MagicMock() swap.users.add(u) swap.subjects.add(s) cl = Classification(1, 2, 0, 0) swap.classify(cl, subject=True, user=False) u.classify.assert_not_called() s.classify.assert_called_with(cl, u)