Best Python code snippet using pandera_python
test_column_mapper.py
Source:test_column_mapper.py
...44 def test_set_tag_columns(self):45 mapper = ColumnMapper()46 mapper.set_tag_columns(self.one_based_tag_columns, finalize_mapping=True)47 self.assertTrue(len(mapper._final_column_map) >= 2)48 def test_optional_column(self):49 mapper = ColumnMapper()50 mapper.set_tag_columns(tag_columns=["HED"])51 mapper.set_column_map({1: "HED"})52 self.assertTrue(len(mapper._final_column_map) == 1)53 mapper = ColumnMapper()54 mapper.set_tag_columns(optional_tag_columns=["HED"])55 mapper.set_column_map({1: "HED"})56 self.assertTrue(len(mapper._final_column_map) == 1)57 mapper = ColumnMapper()58 mapper.set_tag_columns(tag_columns=["HED"])59 self.assertTrue(len(mapper._final_column_map) == 0)60 self.assertTrue(len(mapper._finalize_mapping_issues) == 1)61 mapper = ColumnMapper()62 mapper.set_tag_columns(optional_tag_columns=["HED"])...
datasource.py
Source:datasource.py
...149 ds = Datasource.as_datasource(model=SimpleDemoModel,150 columns=[BooleanColumn('boolean')])151 self.assertSequenceEqual([c.title for c in ds.columns], ['Boolean'])152 self.assertSequenceEqual(ds, [(True,), (True,)])153 def test_optional_column(self):154 G(DemoOptionalModel, n=2, name='abc', user=G(User, n=1, first_name='user1'))155 ds = Datasource.as_datasource(model=DemoOptionalModel,156 columns=[Column('name'), OptionalColumn('user.first_name')])157 self.assertSequenceEqual([c.title for c in ds.columns], ['name', 'first name'])158 self.assertSequenceEqual(ds, [('abc', 'user1',), ('abc', 'user1')])159 def test_optional_column_optional(self):160 G(DemoOptionalModel, n=2, name='abc', user=None)161 ds = Datasource.as_datasource(model=DemoOptionalModel,162 columns=[Column('name'), OptionalColumn('user.first_name')])163 self.assertSequenceEqual([c.title for c in ds.columns], ['name', 'first name'])...
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!!