コード例 #1
0
    def test_if_array(self):
        """
        Test remove_shared if the output is of type list.
        """
        list_1 = [1, 2, 3, 4, 5, 6]
        list_2 = [2, 4, 5, 7]

        duplicates.remove_shared(list_1, list_2)

        self.assertEqual(isinstance(list_1, list), True)
        self.assertEqual(isinstance(list_2, list), True)
コード例 #2
0
    def test_general_case(self):
        """
        Test remove_shared() where there are items that appear in both lists,
        and items that appear in only one or the other list.
        """
        list_1 = [1, 2, 3, 4, 5, 6]
        list_2 = [2, 4, 5, 7]
        list_1_expected = [1, 3, 6]
        list_2_expected = [2, 4, 5, 7]

        duplicates.remove_shared(list_1, list_2)

        self.assertEqual(list_1, list_1_expected)
        self.assertEqual(list_2, list_2_expected)
コード例 #3
0
    def test_long_array(self):
        """
        Test remove_shared where there are items that appear in 
        both lists, and intems that appear in only one or othe other list.
        """
        list_1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
        list_2 = [2, 4, 5, 7]

        list_1_expected = [1, 3, 6, 8, 9, 10]
        list_2_expected = [2, 4, 5, 7]

        duplicates.remove_shared(list_1, list_2)

        self.assertEqual(list_1, list_1_expected)
        self.assertEqual(list_2, list_2_expected)
コード例 #4
0
ファイル: test_duplicates.py プロジェクト: shifteight/python
    def test_general_case(self):
        """
        Test remove_shared where there are items that
        appear in both lists, and items that appear in only
        one or the other list.
        """

        list_1 = [1, 2, 3, 4, 5, 6]
        list_2 = [2, 4, 5, 7]
        list_1_expected = [1, 3, 6]
        list_2_expected = [2, 4, 5, 7]

        duplicates.remove_shared(list_1, list_2)

        self.assertEqual(list_1, list_1_expected)
        self.assertEqual(list_2, list_2_expected)