Debian Codegraph @

tests/utils_tests/test_simplelazyobject.py

raw
1 import pickle
2
3 from django.contrib.auth.models import User
4 from django.test import TestCase
5 from django.utils.functional import SimpleLazyObject
6
7
8 class TestUtilsSimpleLazyObjectDjangoTestCase(TestCase):
9 def test_pickle(self):
10 user = User.objects.create_user("johndoe", "[email protected]", "pass")
11 x = SimpleLazyObject(lambda: user)
12 pickle.dumps(x)
13 # Try the variant protocol levels.
14 pickle.dumps(x, 0)
15 pickle.dumps(x, 1)
16 pickle.dumps(x, 2)