Ticket #32306: test.py
File test.py, 420 bytes (added by , 4 years ago) |
---|
Line | |
---|---|
1 | from datetime import datetime |
2 | import time |
3 | from django.utils.functional import classproperty |
4 | from functools import lru_cache |
5 | import timeit |
6 | |
7 | |
8 | class TestClass: |
9 | |
10 | @classproperty |
11 | @lru_cache |
12 | def test_property(self): |
13 | time.sleep(2) |
14 | |
15 | |
16 | def timeit(): |
17 | start = datetime.now() |
18 | TestClass.test_property |
19 | end = datetime.now() |
20 | duration = end - start |
21 | return duration |
22 | |
23 | print(timeit()) |
24 | print(timeit()) |
25 |