Пример #1
0
    def test_removing_entire_list(self):
        # Use a copy so we're not hitting the exact same object in memory.
        target = list(self.base)

        du.recursive_list_removal(self.base, target)

        self.assertEqual(0, len(self.base))
Пример #2
0
    def test_using_base_as_target(self):
        target = self.base

        du.recursive_list_removal(self.base, target)

        self.assertEqual(1, len(self.base))
        self.assertEqual(1, len(target))
        self.assertIn('bar', self.base)
Пример #3
0
    def test_using_bare_string(self):
        target = 'foo'

        du.recursive_list_removal(self.base, target)

        self.assertEqual(2, len(self.base))
Пример #4
0
    def test_removing_one_target(self):
        target = ['bar']

        du.recursive_list_removal(self.base, target)

        self.assertNotIn('bar', self.base)