def test_draw_hint_member_errors(self, dummy_am): am = AttributeManager(self.description, []) with pytest.raises( ValueError, match=f'is not a valid question for {self.description}'): am.draw_hint_member(dummy_am) am = AttributeManager(self.description, [dummy_am]) with pytest.raises(RuntimeError, match='currently not hintable for dummy'): am.draw_hint_member(dummy_am)
def test_draw_hint_member_free_text(self): am = AttributeManager(self.description, ['first_name']) bm = AttributeManager('first_name', []) for i in range(4): member = Member(i, first_name=str(i), last_name=str(i)) am.register_member(member) bm.register_member(member) member = Member(i + 10, first_name=str(i)) am.register_member(member) bm.register_member(member) member = Member(i + 20, last_name=str(i)) am.register_member(member) bm.register_member(member) member = Member(100, first_name='A', last_name='B') am.register_member(member) bm.register_member(member) member = am.draw_hint_member(bm, multiple_choice=False) assert member.last_name and member.first_name assert member in am.available_members assert member in bm.available_members assert am.is_hintable_with_member(bm, member, multiple_choice=False) assert len(am.unique_attributes_of(member)) >= 1
def test_draw_hint_member(self, runs): am = AttributeManager(self.description, ['first_name']) bm = AttributeManager('first_name', []) for i in range(4): member = Member(i, first_name=str(i), last_name=str(i)) am.register_member(member) bm.register_member(member) member = Member(i + 10, first_name=str(i)) am.register_member(member) bm.register_member(member) member = Member(i + 20, last_name=str(i)) am.register_member(member) bm.register_member(member) member = am.draw_hint_member(bm, exclude_members=[Member(0)]) assert member != Member(0) assert member.last_name and member.first_name assert member in am.available_members assert member in bm.available_members assert am.is_hintable_with_member(bm, member) assert len(bm.distinct_values_for_member(am, member)) >= 3