def test_all_unique(self):
        # works with length 5
        assert CollectionsHelper.all_unique(['a', 'b', 'c', 'd','e']), \
            'The method CollectionsHelper.all_unique does not work correctly.'

        # works with a different length (4)
        assert CollectionsHelper.all_unique(['a', 'b', 'c', 'd']), \
            'The method CollectionsHelper.all_unique does not work correctly.'

        # works if there are duplicate 'a' next to each other
        assert not CollectionsHelper.all_unique(['a', 'a', 'c', 'd','e']), \
            'The method CollectionsHelper.all_unique does not work correctly.'

        # works if the duplicate items are not next to each other
        assert not CollectionsHelper.all_unique(['a', 'b', 'a', 'd','e']), \
            'The method CollectionsHelper.all_unique does not work correctly.'

        # works for other characters than 'a'
        assert not CollectionsHelper.all_unique(['a', 'b', 'c', 'b','e']), \
            'The method CollectionsHelper.all_unique does not work correctly.'

        # lower case upper case distinguishing
        assert CollectionsHelper.all_unique(['a', 'A', 'c', 'd','e']), \
            'The method CollectionsHelper.all_unique does not work correctly.'

        # works for numbers as well
        assert CollectionsHelper.all_unique([1, 2, 3, 4]), \
            'The method CollectionsHelper.all_unique does not work correctly.'
        assert CollectionsHelper.all_unique([1, 2, 3, 4, 5]), \
            'The method CollectionsHelper.all_unique does not work correctly.'
        assert not CollectionsHelper.all_unique([1, 2, 2, 4, 5]), \
            'The method CollectionsHelper.all_unique does not work correctly.'
        assert not CollectionsHelper.all_unique([1, 2, 5, 4, 5]), \
            'The method CollectionsHelper.all_unique does not work correctly.'
    def test_remove_vocable_by_index(self):
        number_of_vocables = len(VocableManager.vocables)
        random_indices = []
        selected_vocables = []
        for index in range(100):
            # get an index, which we've not yet selected
            random_index = randint(0, number_of_vocables-1)
            while random_index in random_indices:
                random_index = randint(0, number_of_vocables-1)
            random_indices.append(random_index)

        assert CollectionsHelper.all_unique(random_indices), \
            'Trying to remove vocable of one and the same index twice during test.'

        deleted_vocables = []
        random_indices.sort(reverse=True)

        for vocable_index in random_indices:
            deleted_vocables.append(VocableManager.vocables[vocable_index])
            VocableManager.remove_vocable_by_index(vocable_index)
            assert deleted_vocables[-1] is not None, \
                'There is no handle on the deleted vocable anymore.'
            assert deleted_vocables[-1] not in VocableManager.vocables, \
                'Vocable was not deleted from vocables.'

        for vocable in deleted_vocables:
            print(vocable)

        for vocable in deleted_vocables:
            assert vocable not in VocableManager.vocables, \
                'Vocable was not deleted from vocables.'
    def test_remove_vocable_by_index(self):
        number_of_vocables = len(VocableManager.vocables)
        random_indices = []
        selected_vocables = []
        for index in range(100):
            # get an index, which we've not yet selected
            random_index = randint(0, number_of_vocables - 1)
            while random_index in random_indices:
                random_index = randint(0, number_of_vocables - 1)
            random_indices.append(random_index)

        assert CollectionsHelper.all_unique(random_indices), \
            'Trying to remove vocable of one and the same index twice during test.'

        deleted_vocables = []
        random_indices.sort(reverse=True)

        for vocable_index in random_indices:
            deleted_vocables.append(VocableManager.vocables[vocable_index])
            VocableManager.remove_vocable_by_index(vocable_index)
            assert deleted_vocables[-1] is not None, \
                'There is no handle on the deleted vocable anymore.'
            assert deleted_vocables[-1] not in VocableManager.vocables, \
                'Vocable was not deleted from vocables.'

        for vocable in deleted_vocables:
            print(vocable)

        for vocable in deleted_vocables:
            assert vocable not in VocableManager.vocables, \
                'Vocable was not deleted from vocables.'
    def test_remove_vocable(self):
        # copied_vocables = []
        # for index, vocable in enumerate(VocableManager.vocables):
        #     current_vocable = VocableManager.vocables[index]
        #     copied_vocables.append(current_vocable.clone())
        #
        # assert len(copied_vocables) == len(VocableManager.vocables), \
        #     'Not all vocables were copied.'
        #
        # for index, vocable in enumerate(copied_vocables):
        #     if vocable not in VocableManager.vocables:
        #         print(vocable)

        number_of_vocables = len(VocableManager.vocables)
        random_indices = []
        selected_vocables = []
        for index in range(1000):
            # get an index, which we've not yet selected
            random_index = randint(0, number_of_vocables-1)
            while random_index in random_indices:
                random_index = randint(0, number_of_vocables-1)
            random_indices.append(random_index)
            selected_vocables.append(VocableManager.vocables[random_index])

        assert CollectionsHelper.all_unique(random_indices), \
            'Trying to remove vocable of one and the same index twice during test.'

        for selected_vocable in selected_vocables:
            VocableManager.remove_vocable(selected_vocable)
            # VocableManager.vocables.remove(selected_vocable)

            assert selected_vocable not in VocableManager.vocables, \
                'Vocable was not deleted from vocables. ' + \
                str(VocableManager.test_call_counter) + \
                ' calls for deletion.' + \
                ' The vocable which was not deleted is ' + str(selected_vocable)

            print('Vocable deleted: ' + str(selected_vocable))
    def test_remove_vocable(self):
        # copied_vocables = []
        # for index, vocable in enumerate(VocableManager.vocables):
        #     current_vocable = VocableManager.vocables[index]
        #     copied_vocables.append(current_vocable.clone())
        #
        # assert len(copied_vocables) == len(VocableManager.vocables), \
        #     'Not all vocables were copied.'
        #
        # for index, vocable in enumerate(copied_vocables):
        #     if vocable not in VocableManager.vocables:
        #         print(vocable)

        number_of_vocables = len(VocableManager.vocables)
        random_indices = []
        selected_vocables = []
        for index in range(1000):
            # get an index, which we've not yet selected
            random_index = randint(0, number_of_vocables - 1)
            while random_index in random_indices:
                random_index = randint(0, number_of_vocables - 1)
            random_indices.append(random_index)
            selected_vocables.append(VocableManager.vocables[random_index])

        assert CollectionsHelper.all_unique(random_indices), \
            'Trying to remove vocable of one and the same index twice during test.'

        for selected_vocable in selected_vocables:
            VocableManager.remove_vocable(selected_vocable)
            # VocableManager.vocables.remove(selected_vocable)

            assert selected_vocable not in VocableManager.vocables, \
                'Vocable was not deleted from vocables. ' + \
                str(VocableManager.test_call_counter) + \
                ' calls for deletion.' + \
                ' The vocable which was not deleted is ' + str(selected_vocable)

            print('Vocable deleted: ' + str(selected_vocable))