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
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
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_get_gold(self): swap = SWAP() labels = {0: 1, 1: 1, 2: 0, 3: 0} swap.set_gold_labels(labels) assert swap.golds == labels