Best Python code snippet using pandera_python
checks.py
Source:checks.py
...863 ),864 )865 @classmethod866 @register_check_statistics(["values"])867 def unique_values_eq(868 cls,869 values: Iterable,870 **kwargs,871 ) -> "Check":872 """Ensure that the unique values in the data object contain all specified values.873 .. note::874 In constrast with :meth:`Check.isin`, this check makes sure that all the items875 in the ``values`` iterable are contained within the series.876 :param values: The set of values that must be present. Maybe any iterable.877 :param kwargs: key-word arguments passed into the `Check` initializer.878 :returns: :class:`Check` object879 """880 set_values = frozenset(values)881 def _unique_values_eq(series: pd.Series) -> pd.Series:882 """Comparison function for check"""883 return set(series.unique()) == set_values884 return cls(885 _unique_values_eq,886 **_check_kwargs(887 kwargs,888 cls.unique_values_eq.__name__,889 f"unique_values_eq({values})",890 ),...
test_checks_builtin.py
Source:test_checks_builtin.py
...918 [[1.0, 2.0, 3.0] * 10, [1.0, 2.0], False, {}],919 [[1.0, 2.0, 3.0] * 10, [1.0, 2.0, 3.0, 4.0], False, {}],920 ],921)922def test_unique_values_eq(series_values, check_arg, passes, failure_cases):923 """Test that unique_values_eq works as expected."""924 check_values(925 pd.Series(series_values),926 Check.unique_values_eq(check_arg),927 passes,928 failure_cases,929 )930@pytest.mark.parametrize("values", [1, 1.0])931def test_unique_values_eq_raise_error(values):932 """Test that unique_values_eq raises an error arg is not iterable."""933 with pytest.raises(TypeError):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!