test_copy.py 824 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import copy
  2. def test_copy(any_multidict_class):
  3. d = any_multidict_class()
  4. d["foo"] = 6
  5. d2 = d.copy()
  6. d2["foo"] = 7
  7. assert d["foo"] == 6
  8. assert d2["foo"] == 7
  9. def test_copy_proxy(any_multidict_class, any_multidict_proxy_class):
  10. d = any_multidict_class()
  11. d["foo"] = 6
  12. p = any_multidict_proxy_class(d)
  13. d2 = p.copy()
  14. d2["foo"] = 7
  15. assert d["foo"] == 6
  16. assert p["foo"] == 6
  17. assert d2["foo"] == 7
  18. def test_copy_std_copy(any_multidict_class):
  19. d = any_multidict_class()
  20. d["foo"] = 6
  21. d2 = copy.copy(d)
  22. d2["foo"] = 7
  23. assert d["foo"] == 6
  24. assert d2["foo"] == 7
  25. def test_ci_multidict_clone(any_multidict_class):
  26. d = any_multidict_class(foo=6)
  27. d2 = any_multidict_class(d)
  28. d2["foo"] = 7
  29. assert d["foo"] == 6
  30. assert d2["foo"] == 7