B @`@sddlZddlZddlmZejddZejddZejddZejd d Zejdd gd d d Z ejddZ ejddZ ejddZ ejddZ ejddZejddZejddgd ddZejddd dd!dd"dgd#d$d%d&gd'd(d)Zejddgd d*d+Zejddgd d,d-Zejddgd d.d/Zejd0d1gd d2d3Zejddgd d4d5ZdS)6N)SeriescCstdS)z3A fixture providing the ExtensionDtype to validate.N)NotImplementedErrorrrC/tmp/pip-unpacked-wheel-q9tj5l6a/pandas/tests/extension/conftest.pydtypesrcCstdS)z Length-100 array for this type. * data[0] and data[1] should both be non missing * data[0] and data[1] should not be equal N)rrrrrdatasrcCstdS)z3Length-100 array in which all the elements are two.N)rrrrr data_for_twossrcCstdS)zLength-2 array with [NA, Valid]N)rrrrr data_missingsr )paramscCs |jdkr|S|jdkr|SdS)z5Parametrized fixture giving 'data' and 'data_missing'rr N)param)requestrr rrrall_data%s  r csfdd}|S)a  Generate many datasets. Parameters ---------- data : fixture implementing `data` Returns ------- Callable[[int], Generator]: A callable that takes a `count` argument and returns a generator yielding `count` datasets. c3sxt|D] }Vq WdS)N)range)count_)rrrgen>szdata_repeated..genr)rrr)rr data_repeated.s rcCstdS)zn Length-3 array with a known sort order. This should be three items [B, C, A] with A < B < C N)rrrrrdata_for_sortingEsrcCstdS)z{ Length-3 array with a known sort order. This should be three items [B, NA, A] with A < B and NA missing. N)rrrrrdata_missing_for_sortingPsrcCstjS)z Binary operator for comparing NA values. Should return a function of two arguments that returns True if both arguments are (scalar) NA for your type. By default, uses ``operator.is_`` )operatoris_rrrrna_cmp[s rcCsdS)z6The scalar missing value for this type. Default 'None'Nrrrrrna_valuehsrcCstdS)z Data for factorization, grouping, and unique tests. Expected to be like [B, B, NA, NA, A, A, B, C] Where A < B < C and NA is missing N)rrrrrdata_for_groupingns rTFcCs|jS)z#Whether to box the data in a Series)r )r rrr box_in_serieszsrcCsdS)Nr)xrrrrcCsdgt|S)Nr)len)rrrrrrcCstdgt|S)Nr)rr)rrrrrrcCs|S)Nr)rrrrrrZscalarlistZseriesobject)r idscCs|jS)z, Functions to test groupby.apply(). )r )r rrrgroupby_apply_ops r#cCs|jS)zU Boolean fixture to support Series and Series.to_frame() comparison testing. )r )r rrras_framesr$cCs|jS)zL Boolean fixture to support arr and Series(arr) comparison testing. )r )r rrr as_seriessr%cCs|jS)zd Boolean fixture to support comparison testing of ExtensionDtype array and numpy array. )r )r rrr use_numpysr&ZffillZbfillcCs|jS)z{ Parametrized fixture giving method parameters 'ffill' and 'bfill' for Series.fillna(method=) testing. )r )r rrr fillna_methodsr'cCs|jS)zR Boolean fixture to support ExtensionDtype _from_sequence method testing. )r )r rrras_arraysr()rZpytestZpandasrZfixturerrrr r rrrrrrrr#r$r%r&r'r(rrrrs2