Beispiel #1
0
    def test_without_duplicates(self):
        choices = ["01", "02"]
        identifiers = ["1", "2"]

        choices_resolved = resolve_duplicates(choices=choices,
                                              identifiers=identifiers)
        assert choices_resolved == ["01", "02"]
Beispiel #2
0
    def test_with_duplicates(self):
        choices = ["choice", "choice"]
        identifiers = ["1", "2"]

        choices_resolved = resolve_duplicates(choices=choices,
                                              identifiers=identifiers)
        assert choices_resolved == [CHOICE_01, CHOICE_02]
Beispiel #3
0
    def test_without_duplicates_and_help_text(self):
        choices = ["01", "02"]
        identifiers = ["1", "2"]
        help_texts = ["help", "help"]

        choices_resolved = resolve_duplicates(choices=choices,
                                              identifiers=identifiers,
                                              help_texts=help_texts)
        assert choices_resolved == ["01", "02"]
Beispiel #4
0
    def test_filter_existing_01(self):
        choices = ["choice", "choice"]
        identifiers = ["1", "2"]
        filter_ = ["1"]

        choices_resolved = resolve_duplicates(choices=choices,
                                              identifiers=identifiers)
        choices_filtered = filter_by_identifiers(choices=choices_resolved,
                                                 identifiers=identifiers,
                                                 filter=filter_)
        assert choices_filtered == [CHOICE_01]
Beispiel #5
0
    def test_filter_empty_list(self):
        choices = ["choice", "choice"]
        identifiers = ["1", "2"]
        filter_ = []

        choices_resolved = resolve_duplicates(choices=choices,
                                              identifiers=identifiers)
        choices_filtered = filter_by_identifiers(choices=choices_resolved,
                                                 identifiers=identifiers,
                                                 filter=filter_)
        assert choices_filtered == []
Beispiel #6
0
    def test_filter_none(self):
        choices = ["choice", "choice"]
        identifiers = ["1", "2"]
        filter_ = None

        choices_resolved = resolve_duplicates(choices=choices,
                                              identifiers=identifiers)
        choices_filtered = filter_by_identifiers(choices=choices_resolved,
                                                 identifiers=identifiers,
                                                 filter=filter_)
        assert choices_filtered == [CHOICE_01, CHOICE_02]
Beispiel #7
0
    def test_excludes_non_existing(self):
        choices = ["choice", "choice"]
        identifiers = ["1", "2"]
        excludes = ["3"]

        choices_resolved = resolve_duplicates(choices=choices,
                                              identifiers=identifiers)
        choices_excluded = exclude_by_identifiers(choices=choices_resolved,
                                                  identifiers=identifiers,
                                                  excludes=excludes)
        assert choices_excluded == [CHOICE_01, CHOICE_02]