示例#1
0
    def test_unique_attributes_of(self, member):
        member.instruments = [Tuba(), Trombone()]
        am = AttributeManager('instruments', [])
        am.register_member(member)
        am.register_member(Member(5, instruments=[Tuba()]))
        assert am.unique_attributes_of(member) == [Trombone()]

        bm = AttributeManager('age', [])
        assert bm.unique_attributes_of(member) == []
示例#2
0
    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