MCPcopy Create free account
hub / github.com/dateutil/dateutil / test_tzoffset_weakref

Function test_tzoffset_weakref

tests/test_tz.py:759–775  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

757@pytest.mark.smoke
758@pytest.mark.tzoffset
759def test_tzoffset_weakref():
760 UTC1 = tz.tzoffset('UTC', 0)
761 UTC_ref = weakref.ref(tz.tzoffset('UTC', 0))
762 UTC1 is UTC_ref()
763 del UTC1
764 gc.collect()
765
766 assert UTC_ref() is not None # Should be in the strong cache
767 assert UTC_ref() is tz.tzoffset('UTC', 0)
768
769 # Fill the strong cache with other items
770 for offset in range(5,15):
771 tz.tzoffset('RandomZone', offset)
772
773 gc.collect()
774 assert UTC_ref() is None
775 assert UTC_ref() is not tz.tzoffset('UTC', 0)
776
777
778@pytest.mark.tzoffset

Callers

nothing calls this directly

Calls 1

tzoffsetMethod · 0.80

Tested by

no test coverage detected