Esempio n. 1
0
    def test_distinct_values_for_member_full_name(self, member, gender,
                                                  other_gender):
        am = NameManager('full_name', [])
        bm = AttributeManager('instruments', [], gendered_questions=True)

        for i in range(10):
            am.register_member(Member(i, last_name='a', instruments=[Tuba()]))

        for g in [None, gender, other_gender]:
            assert (am.distinct_values_for_member(
                bm, Member(100, last_name='a', instruments=[Tuba()],
                           gender=g)) == set())
            assert (am.distinct_values_for_member(
                bm, Member(100, last_name='c', instruments=[Tuba()],
                           gender=g)) == set())

        am.register_member(Member(200, last_name='A', instruments=[Trumpet()]))
        assert (am.distinct_values_for_member(
            bm,
            Member(200, last_name='A', instruments=[Trumpet()],
                   gender=gender)) == set())
        assert am.distinct_values_for_member(
            bm, Member(200, last_name='A', instruments=[Trumpet()])) == {'a'}
Esempio n. 2
0
    def test_distinct_values_for_member(self, member, gender, other_gender):
        am = NameManager(self.description, [])
        bm = AttributeManager('last_name', [], gendered_questions=True)

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

        for g in [None, gender, other_gender]:
            assert (am.distinct_values_for_member(
                bm, Member(100, last_name='a', first_name='b',
                           gender=g)) == set())
            assert (am.distinct_values_for_member(
                bm, Member(100, last_name='c', first_name='b',
                           gender=g)) == set())

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

        for g in [None, gender, other_gender]:
            assert (am.distinct_values_for_member(
                bm, Member(100, last_name='a', first_name='b',
                           gender=g)) == set())
            assert (am.distinct_values_for_member(
                bm, Member(100, last_name='c', first_name='b',
                           gender=g)) == set())

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

        assert (am.distinct_values_for_member(
            bm, Member(100, last_name='a', first_name='b',
                       gender=gender)) == set())
        assert am.distinct_values_for_member(
            bm, Member(100, last_name='c', first_name='b',
                       gender=gender)) == {'0', '1', '2', '3', '4'}
        assert (am.distinct_values_for_member(
            bm, Member(100, last_name='a', first_name='b',
                       gender=other_gender)) == set())
        assert (am.distinct_values_for_member(
            bm, Member(100, last_name='c', first_name='b',
                       gender=other_gender)) == set())
Esempio n. 3
0
    def test_distinct_values_for_member_no_attr(self, member):
        am = NameManager(self.description, [])
        bm = AttributeManager('last_name', [])

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