Best Python code snippet using pandera_python
test_purity.py
Source:test_purity.py  
...93        self.test_obj.check_groups = mock.Mock(return_value=69)94        self.test_obj.check_relations(g_df, relations)95        self.test_obj.check_groups.assert_called_with(g_df, 'text_id',96                [1, 2, 3])97    def test_check_groups(self):98        g_df = tu.sample_group_df()99        g_df.columns = ['text_id']100        self.test_obj.check_group = mock.Mock()101        self.test_obj.check_group.side_effect = [77, 88]102        result = self.test_obj.check_groups(g_df, 'text_id', [1, 2])103        self.assertTrue(self.test_obj.check_group.call_count == 2)104        self.assertTrue(result == 165)105    def test_check_group(self):106        g_df = tu.sample_df(10)107        g_df['label'] = [1, 1, 1, 1, 0, 1, 0, 1, 0, 1]108        result = self.test_obj.check_group(g_df)109        self.assertTrue(np.array_equal(np.isclose([result], [3.0]), [True]))110def test_suite():111    suite = unittest.TestLoader().loadTestsFromTestCase(PurityTestCase)...test_utils.py
Source:test_utils.py  
...16    assert output == reference  # nosec17def test_stringify_sequence_error():18    with pytest.raises(TypeError):19        _stringify_sequence(0)20def test_check_groups():21    X, y, groups_in = make_group_regression()22    _, n_features = X.shape23    groups_out = check_groups(groups=groups_in, X=X)24    assert groups_out == tuple(groups_in)25    # Test the groups=None defaults26    groups_out = check_groups(groups=None, X=X, fit_intercept=False)27    assert_array_almost_equal(groups_out, [np.arange(n_features)])28    groups_out = check_groups(groups=None, X=X, fit_intercept=True)29    assert_array_almost_equal(groups_out, [np.arange(n_features - 1)])30    # Test Value error on missing features in groups31    with pytest.raises(ValueError):32        check_groups(groups=groups_in[1:], X=X)33    # Test Value error on missing groups in features34    with pytest.raises(ValueError):...test_it.py
Source:test_it.py  
...7abcz8"""9        self.assertEqual(6, groups.count_questions(code))10    11    def test_check_groups(self):12        code = """abc13a14b15c16ab17ac18a19a20a21a22b23"""24        self.assertEqual(11, groups.total_yes(code))25    ...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!!
