@@ -1370,14 +1370,14 @@ class Ex(Struct, Generic[T]):
13701370 dec = proto .Decoder (typ )
13711371 info = typ .__msgspec_cache__
13721372 assert info is not None
1373- assert sys .getrefcount (info ) = = 4 # info + attr + decoder + func call
1373+ assert sys .getrefcount (info ) < = 4 # info + attr + decoder + func call
13741374 dec2 = proto .Decoder (typ )
13751375 assert typ .__msgspec_cache__ is info
1376- assert sys .getrefcount (info ) = = 5
1376+ assert sys .getrefcount (info ) < = 5
13771377
13781378 del dec
13791379 del dec2
1380- assert sys .getrefcount (info ) = = 3
1380+ assert sys .getrefcount (info ) < = 3
13811381
13821382 def test_generic_struct_invalid_types_not_cached (self , proto ):
13831383 class Ex (Struct , Generic [T ]):
@@ -1545,7 +1545,7 @@ class Ex2(Struct, array_like=array_like, tag=True):
15451545 res = proto .decode (buf , type = typ )
15461546 assert res == msg
15471547 assert count == 2 # 1 for Ex(), 1 for decode
1548- assert sys .getrefcount (singleton ) = = 2 # 1 for ref, 1 for call
1548+ assert sys .getrefcount (singleton ) < = 2 # 1 for ref, 1 for call
15491549
15501550 @pytest .mark .parametrize ("array_like" , [False , True ])
15511551 @pytest .mark .parametrize ("union" , [False , True ])
@@ -1606,14 +1606,14 @@ class Ex(Generic[T]):
16061606 dec = proto .Decoder (typ )
16071607 info = typ .__msgspec_cache__
16081608 assert info is not None
1609- assert sys .getrefcount (info ) = = 4 # info + attr + decoder + func call
1609+ assert sys .getrefcount (info ) < = 4 # info + attr + decoder + func call
16101610 dec2 = proto .Decoder (typ )
16111611 assert typ .__msgspec_cache__ is info
1612- assert sys .getrefcount (info ) = = 5
1612+ assert sys .getrefcount (info ) < = 5
16131613
16141614 del dec
16151615 del dec2
1616- assert sys .getrefcount (info ) = = 3
1616+ assert sys .getrefcount (info ) < = 3
16171617
16181618 def test_generic_invalid_types_not_cached (self , decorator , proto ):
16191619 @decorator
@@ -2197,14 +2197,14 @@ class Ex(TypedDict, Generic[T]):
21972197 dec = proto .Decoder (typ )
21982198 info = typ .__msgspec_cache__
21992199 assert info is not None
2200- assert sys .getrefcount (info ) = = 4 # info + attr + decoder + func call
2200+ assert sys .getrefcount (info ) < = 4 # info + attr + decoder + func call
22012201 dec2 = proto .Decoder (typ )
22022202 assert typ .__msgspec_cache__ is info
2203- assert sys .getrefcount (info ) = = 5
2203+ assert sys .getrefcount (info ) < = 5
22042204
22052205 del dec
22062206 del dec2
2207- assert sys .getrefcount (info ) = = 3
2207+ assert sys .getrefcount (info ) < = 3
22082208
22092209 def test_generic_typeddict_invalid_types_not_cached (self , proto ):
22102210 TypedDict = pytest .importorskip ("typing_extensions" ).TypedDict
@@ -2416,14 +2416,14 @@ class Ex(NamedTuple, Generic[T]):
24162416 dec = proto .Decoder (typ )
24172417 info = typ .__msgspec_cache__
24182418 assert info is not None
2419- assert sys .getrefcount (info ) = = 4 # info + attr + decoder + func call
2419+ assert sys .getrefcount (info ) < = 4 # info + attr + decoder + func call
24202420 dec2 = proto .Decoder (typ )
24212421 assert typ .__msgspec_cache__ is info
2422- assert sys .getrefcount (info ) = = 5
2422+ assert sys .getrefcount (info ) < = 5
24232423
24242424 del dec
24252425 del dec2
2426- assert sys .getrefcount (info ) = = 3
2426+ assert sys .getrefcount (info ) < = 3
24272427
24282428 def test_generic_namedtuple_invalid_types_not_cached (self , proto ):
24292429 NamedTuple = pytest .importorskip ("typing_extensions" ).NamedTuple
0 commit comments