(ModelTwo)
| 177 | |
| 178 | @pytest.mark.thread_unsafe(reason='`pytest.warns()` is thread unsafe') |
| 179 | def test_copy_exclude(ModelTwo): |
| 180 | m = ModelTwo(a=24, d=Model(a='12')) |
| 181 | m2 = deprecated_copy(m, exclude={'b'}) |
| 182 | |
| 183 | assert m.a == m2.a == 24 |
| 184 | assert isinstance(m2.d, Model) |
| 185 | assert m2.d.a == 12 |
| 186 | |
| 187 | assert hasattr(m2, 'c') |
| 188 | assert not hasattr(m2, 'b') |
| 189 | assert set(m.model_dump().keys()) == {'a', 'b', 'c', 'd'} |
| 190 | assert set(m2.model_dump().keys()) == {'a', 'c', 'd'} |
| 191 | |
| 192 | assert m != m2 |
| 193 | |
| 194 | |
| 195 | @pytest.mark.thread_unsafe(reason='`pytest.warns()` is thread unsafe') |
nothing calls this directly
no test coverage detected