How to use test_dtype_coercion method in pandera

Best Python code snippet using pandera_python

test_deprecations.py

Source:test_deprecations.py Github

copy

Full Screen

...455 np.integer, np.unsignedinteger, np.signedinteger,456 # character is a deprecated S1 special case:457 np.character,458 ]459 def test_dtype_coercion(self):460 for scalar_type in self.deprecated_types:461 self.assert_deprecated(np.dtype, args=(scalar_type,))462 def test_array_construction(self):463 for scalar_type in self.deprecated_types:464 self.assert_deprecated(np.array, args=([], scalar_type,))465 def test_not_deprecated(self):466 # All specific types are not deprecated:467 for group in np.sctypes.values():468 for scalar_type in group:469 self.assert_not_deprecated(np.dtype, args=(scalar_type,))470 for scalar_type in [type, dict, list, tuple]:471 # Typical python types are coerced to object currently:472 self.assert_not_deprecated(np.dtype, args=(scalar_type,))473class BuiltInRoundComplexDType(_DeprecationTestCase):...

Full Screen

Full Screen

test_pyfftw_dask_interface.py

Source:test_pyfftw_dask_interface.py Github

copy

Full Screen

...359 s += i * 2360 i *= i361 self.validate(dtype_tuple[1],362 test_shape, dtype, s, kwargs)363 def test_dtype_coercion(self):364 # Make sure we input a dtype that needs to be coerced365 if functions[self.func] == 'r2c':366 dtype_tuple = self.io_dtypes['complex']367 else:368 dtype_tuple = self.io_dtypes['r2c']369 for dtype in dtype_tuple[0]:370 for test_shape, s, kwargs in self.test_data:371 s = None372 self.validate(dtype_tuple[1],373 test_shape, dtype, s, kwargs)374 def test_input_maintained(self):375 '''Test to make sure the input is maintained by default.376 '''377 dtype_tuple = self.io_dtypes[functions[self.func]]...

Full Screen

Full Screen

test_schemas_on_modin.py

Source:test_schemas_on_modin.py Github

copy

Full Screen

...240 schema(mpd.DataFrame({"another_field": [1, 2, 3]}))241@pytest.mark.parametrize("from_dtype", [str])242@pytest.mark.parametrize("to_dtype", [float, int, str, bool])243@hypothesis.given(st.data())244def test_dtype_coercion(from_dtype, to_dtype, data):245 """Test the datatype coercion provides informative errors."""246 from_schema = pa.DataFrameSchema({"field": pa.Column(from_dtype)})247 to_schema = pa.DataFrameSchema({"field": pa.Column(to_dtype, coerce=True)})248 pd_sample = data.draw(from_schema.strategy(size=3))249 sample = mpd.DataFrame(pd_sample)250 if from_dtype is to_dtype:251 assert isinstance(to_schema(sample), mpd.DataFrame)252 return253 if from_dtype is str and to_dtype in {int, float}:254 try:255 result = to_schema(sample)256 assert result["field"].dtype == to_dtype257 except pa.errors.SchemaError as err:258 for x in err.failure_cases.failure_case:...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pandera automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful