Best Python code snippet using stestr_python
test_dataframe.py
Source:test_dataframe.py  
...805    loads = pickle.loads806    e = d.groupby(d.a).b.sum()807    f = loads(dumps(e))808    assert eq(e, f)809def test_random_partitions():810    a, b = d.random_split([0.5, 0.5])811    assert isinstance(a, dd.DataFrame)812    assert isinstance(b, dd.DataFrame)813    assert len(a.compute()) + len(b.compute()) == len(full)814def test_series_nunique():815    ps = pd.Series(list('aaabbccccdddeee'), name='a')816    s = dd.from_pandas(ps, npartitions=3)817    assert eq(s.nunique(), ps.nunique())818def test_set_partition_2():819    df = pd.DataFrame({'x': [1, 2, 3, 4, 5, 6], 'y': list('abdabd')})820    ddf = dd.from_pandas(df, 2)821    result = ddf.set_partition('y', ['a', 'c', 'd'])822    assert result.divisions == ('a', 'c', 'd')823    assert list(result.compute(get=get_sync).index[-2:]) == ['d', 'd']...test_scheduler.py
Source:test_scheduler.py  
...43        self.assertTrue('fast1' in partitions[1])44        self.assertTrue('fast2' in partitions[1])45        self.assertEqual(3, len(partitions[0]))46        self.assertEqual(4, len(partitions[1]))47    def test_random_partitions(self):48        repo = memory.RepositoryFactory().initialise('memory:')49        test_ids = frozenset(['a_test', 'b_test', 'c_test', 'd_test'])50        random_parts = scheduler.partition_tests(test_ids, 2, repo, None,51                                                 randomize=True)52        # NOTE(masayukig): We can't test this randomness. So just checking53        # what we should get here.54        self.assertEqual(2, len(random_parts))55        self.assertTrue(isinstance(random_parts, list))56        self.assertTrue(isinstance(random_parts[0], list))57        self.assertTrue(isinstance(random_parts[1], list))58        flatten_random_parts = []59        for i, j in random_parts:60            flatten_random_parts.append(i)61            flatten_random_parts.append(j)...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!!
