def test_calculating_number_per_chunk(): cutoff_df = pd.DataFrame({'time': [pd.Timestamp('2011-04-08 10:30:00') for x in range(200)], 'instance_id': [0 for x in range(200)]}) singleton = pd.DataFrame({'time': [pd.Timestamp('2011-04-08 10:30:00')], 'instance_id': [0]}) shape = cutoff_df.shape with pytest.raises(ValueError): calc_num_per_chunk(-1, shape) with pytest.raises(ValueError): calc_num_per_chunk("test", shape) with pytest.raises(ValueError): calc_num_per_chunk(2.5, shape) with pytest.warns(UserWarning): assert calc_num_per_chunk(201, shape) == 200 assert calc_num_per_chunk(200, shape) == 200 assert calc_num_per_chunk(11, shape) == 11 assert calc_num_per_chunk(.7, shape) == 140 assert calc_num_per_chunk(.6749, shape) == 134 assert calc_num_per_chunk(.6751, shape) == 135 assert calc_num_per_chunk(None, shape) == 20 assert calc_num_per_chunk("cutoff time", shape) == "cutoff time" assert calc_num_per_chunk(1, shape) == 1 assert calc_num_per_chunk(.5, singleton.shape) == 1 assert calc_num_per_chunk(None, singleton.shape) == 10
def test_calculating_number_per_chunk(): cutoff_df = pd.DataFrame({'time': [pd.Timestamp('2011-04-08 10:30:00') for x in range(200)], 'instance_id': [0 for x in range(200)]}) singleton = pd.DataFrame({'time': [pd.Timestamp('2011-04-08 10:30:00')], 'instance_id': [0]}) shape = cutoff_df.shape with pytest.raises(ValueError): calc_num_per_chunk(-1, shape) with pytest.raises(ValueError): calc_num_per_chunk("test", shape) with pytest.raises(ValueError): calc_num_per_chunk(2.5, shape) with pytest.warns(UserWarning): assert calc_num_per_chunk(201, shape) == 200 assert calc_num_per_chunk(200, shape) == 200 assert calc_num_per_chunk(11, shape) == 11 assert calc_num_per_chunk(.7, shape) == 140 assert calc_num_per_chunk(.6749, shape) == 134 assert calc_num_per_chunk(.6751, shape) == 135 assert calc_num_per_chunk(None, shape) == 20 assert calc_num_per_chunk("cutoff time", shape) == "cutoff time" assert calc_num_per_chunk(1, shape) == 1 assert calc_num_per_chunk(.5, singleton.shape) == 1 assert calc_num_per_chunk(None, singleton.shape) == 10