| | 52 | @modify_settings(ITEMS={ |
| | 53 | 'append': ['a', 'e'], |
| | 54 | 'remove': ['a', 'c', 'e'], |
| | 55 | }) |
| | 56 | def test_method_list_append_remove_same_values(self): |
| | 57 | # This test fails randomly in Python < 3.6 since dictionaries |
| | 58 | # doesn't have "insert ordering" as in Python >= 3.6 |
| | 59 | |
| | 60 | # This test fails in Python >= 3.6 since it has "insert |
| | 61 | # ordering" and we are first appending the items and then |
| | 62 | # removing them |
| | 63 | self.assertEqual(settings.ITEMS, ['b', 'd', 'a', 'e']) |
| | 64 | |
| | 65 | @modify_settings(ITEMS={ |
| | 66 | 'remove': ['a', 'c', 'e'], |
| | 67 | 'append': ['a', 'e'], |
| | 68 | }) |
| | 69 | def test_method_list_remove_append_same_values(self): |
| | 70 | # This test fails randomly in Python < 3.6 since dictionaries |
| | 71 | # doesn't have "insert ordering" as in Python >= 3.6. |
| | 72 | |
| | 73 | # This test passes in Python >= 3.6 since it has "insert |
| | 74 | # ordering" and we are first removing the items and then |
| | 75 | # appending them |
| | 76 | self.assertEqual(settings.ITEMS, ['b', 'd', 'a', 'e']) |
| | 77 | |
| | 78 | @modify_settings(ITEMS={ |
| | 79 | 'remove': ['a', 'c', 'e'], |
| | 80 | }) |
| | 81 | @modify_settings(ITEMS={ |
| | 82 | 'append': ['a', 'e'], |
| | 83 | }) |
| | 84 | def test_method_list_append_remove_same_values_twice_decorated(self): |
| | 85 | self.assertEqual(settings.ITEMS, ['b', 'd', 'a', 'e']) |
| | 86 | |
| | 87 | @unittest.expectedFailure |
| | 88 | @modify_settings(ITEMS=OrderedDict([ |
| | 89 | ('append', ['a', 'e']), |
| | 90 | ('remove', ['a', 'c', 'e']), |
| | 91 | ])) |
| | 92 | def test_method_list_append_remove_same_values_ordereddict(self): |
| | 93 | # This test fail because it first appends the items and then |
| | 94 | # removes them |
| | 95 | self.assertEqual(settings.ITEMS, ['b', 'd', 'a', 'e']) |
| | 96 | |
| | 97 | @modify_settings(ITEMS=OrderedDict([ |
| | 98 | ('remove', ['a', 'c', 'e']), |
| | 99 | ('append', ['a', 'e']), |
| | 100 | ])) |
| | 101 | def test_method_list_remove_append_same_values_ordereddict(self): |
| | 102 | # This test pass because it first removes the items and then |
| | 103 | # appends them |
| | 104 | self.assertEqual(settings.ITEMS, ['b', 'd', 'a', 'e']) |
| | 105 | |