Asib27's picture
try 1
065fee7 verified
raw
history blame
436 Bytes
import pickle
from yarl import URL
# serialize
def test_pickle():
u1 = URL("test")
hash(u1)
v = pickle.dumps(u1)
u2 = pickle.loads(v)
assert u1._cache
assert not u2._cache
assert hash(u1) == hash(u2)
def test_default_style_state():
u = URL("test")
hash(u)
u.__setstate__((None, {"_val": "test", "_strict": False, "_cache": {"hash": 1}}))
assert not u._cache
assert u._val == "test"