(self, copy_fun, default_count)
| 58 | @pytest.mark.parametrize('copy_fun', [lambda view: view.copy(), copy]) |
| 59 | @pytest.mark.parametrize('default_count', [0, 1, 2, 4]) |
| 60 | def test_copy(self, copy_fun, default_count): |
| 61 | nested = [] |
| 62 | defaults = [{'default': index} for index in range(default_count)] |
| 63 | view = ConfigurationView({'changed': 1, 'nested': nested}, defaults) |
| 64 | |
| 65 | copied = copy_fun(view) |
| 66 | |
| 67 | assert dict(copied) == dict(view) |
| 68 | assert copied is not view |
| 69 | assert copied.changes is not view.changes |
| 70 | assert copied.nested is nested |
| 71 | assert copied.defaults is not view.defaults |
| 72 | for original, duplicate in zip(view.defaults, copied.defaults): |
| 73 | assert duplicate is original |
| 74 | copied.changed = 2 |
| 75 | assert view.changed == 1 |
| 76 | copied.add_defaults({'additional': 3}) |
| 77 | assert 'additional' not in view |
| 78 | if defaults: |
| 79 | defaults[0]['default'] = 10 |
| 80 | assert copied.default == view.default == 10 |
| 81 | |
| 82 | @pytest.mark.parametrize('copy_fun', [lambda view: view.copy(), copy]) |
| 83 | def test_copy_preserves_key_conversions(self, copy_fun): |
nothing calls this directly
no test coverage detected