()
| 1216 | @pytest.mark.smoke |
| 1217 | @pytest.mark.gettz |
| 1218 | def test_gettz_weakref(): |
| 1219 | tz.gettz.cache_clear() |
| 1220 | tz.gettz.set_cache_size(2) |
| 1221 | NYC1 = tz.gettz('America/New_York') |
| 1222 | NYC_ref = weakref.ref(tz.gettz('America/New_York')) |
| 1223 | |
| 1224 | assert NYC1 is NYC_ref() |
| 1225 | |
| 1226 | del NYC1 |
| 1227 | gc.collect() |
| 1228 | |
| 1229 | assert NYC_ref() is not None # Should still be in the strong cache |
| 1230 | assert tz.gettz('America/New_York') is NYC_ref() |
| 1231 | |
| 1232 | # Populate strong cache with other timezones |
| 1233 | tz.gettz("Europe/Paris") |
| 1234 | tz.gettz("Pacific/Easter") |
| 1235 | tz.gettz("Australia/Hobart") |
| 1236 | |
| 1237 | gc.collect() |
| 1238 | assert NYC_ref() is None # Should have been pushed out |
| 1239 | assert tz.gettz('America/New_York') is not NYC_ref() |
| 1240 | |
| 1241 | @requires_tzdata |
| 1242 | class ZoneInfoGettzTest(GettzTest): |
nothing calls this directly
no test coverage detected