Esempio n. 1
0
    def test_distinct_values_for_member(self, member):
        am = AttributeManager(self.description, [])
        bm = AttributeManager('first_name', [])

        for i in range(10):
            am.register_member(Member(i, first_name='a', last_name='b'))

        assert (am.distinct_values_for_member(
            bm, Member(100, first_name='a', last_name='b')) == set())
        assert (am.distinct_values_for_member(
            bm, Member(100, first_name='c', last_name='b')) == set())

        for i in range(5):
            am.register_member(Member(i + 10, first_name=str(i),
                                      last_name='b'))

        assert (am.distinct_values_for_member(
            bm, Member(100, first_name='a', last_name='b')) == set())
        assert (am.distinct_values_for_member(
            bm, Member(100, first_name='c', last_name='b')) == set())

        for i in range(5):
            am.register_member(Member(i + 20, first_name='a',
                                      last_name=str(i)))

        assert (am.distinct_values_for_member(
            bm, Member(100, first_name='a', last_name='b')) == set())
        assert am.distinct_values_for_member(
            bm, Member(100, first_name='c', last_name='b')) == {
                '0',
                '1',
                '2',
                '3',
                '4',
            }
Esempio n. 2
0
    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
Esempio n. 3
0
    def test_distinct_values_for_member_no_attr(self, member):
        am = AttributeManager(self.description, [])
        bm = AttributeManager('first_name', [])

        assert am.distinct_values_for_member(bm, Member(1)) == set()