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_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)
def get_bureau(self): b = Bureau(Subject) for i in range(5): b.add(Subject(i)) return b
def test_add_agent_typecheck(self): b = Bureau(User) agent = Subject(0) with pytest.raises(TypeError): b.add(agent)
def test_stats_subject(self): b = Bureau(Subject) [b.add(Subject(i)) for i in range(5)] [s.ledger.recalculate() for s in b] b.stats()