Best Python code snippet using pandera_python
test_decorators.py
Source:test_decorators.py
...160 test_func(pd.DataFrame({"column1": [1, 2, 3]}))161 # case 2: check that if the input decorator refers to an index that's not162 # in the function signature, it will fail in a way that's easy to interpret163 @check_input(DataFrameSchema({"column1": Column(Int)}), 1)164 def test_incorrect_check_input_index(df):165 return df166 with pytest.raises(167 IndexError, match=r"^error in check_input decorator of function"168 ):169 test_incorrect_check_input_index(pd.DataFrame({"column1": [1, 2, 3]}))170def test_check_input_method_decorators() -> None:171 """Test the check_input and check_output decorator behaviours when the172 dataframe is changed within the function being checked"""173 in_schema = DataFrameSchema({"column1": Column(String)})174 out_schema = DataFrameSchema({"column2": Column(Int)})175 dataframe = pd.DataFrame({"column1": ["a", "b", "c"]})176 def _transform_helper(df):177 return df.assign(column2=[1, 2, 3])178 class TransformerClass:179 """Contains functions with different signatures representing the way180 that the decorators can be called."""181 # pylint: disable=E0012,C0111,C0116,W0613,R0201182 # disables missing-function-docstring as this is a factory method183 # disables unused-arguments because handling the second argument is...
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!!