@@ -2032,3 +2032,23 @@ def test_arg_tz_ns_unit(self, offset, utc, exp):
20322032 result = to_datetime ([arg ], unit = 'ns' , utc = utc )
20332033 expected = to_datetime ([exp ])
20342034 tm .assert_index_equal (result , expected )
2035+
2036+
2037+ @pytest .mark .parametrize ('listlike,do_caching' , [
2038+ ([1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ], False ),
2039+ ([1 , 1 , 1 , 1 , 4 , 5 , 6 , 7 , 8 , 9 ], True )
2040+ ])
2041+ def test_should_cache (listlike , do_caching ):
2042+ assert tools .should_cache (listlike , check_count = len (listlike ),
2043+ unique_share = 0.7 ) == do_caching
2044+
2045+
2046+ @pytest .mark .parametrize ('check_count,unique_share, err_message' , [
2047+ (11 , 0.5 , r'check_count must be in next bounds: \(0; len\(arg\)]' ),
2048+ (10 , 2 , r'unique_share must be in next bounds: \(0; 1\)' )
2049+ ])
2050+ def test_should_cache_errors (check_count , unique_share , err_message ):
2051+ arg = [5 ] * 10
2052+
2053+ with pytest .raises (AssertionError , match = err_message ):
2054+ tools .should_cache (arg , check_count , unique_share )
0 commit comments