Skip to content

TST: Reduce some test data sizes #57897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas/tests/frame/methods/test_cov_corr.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,8 @@ def test_corrwith_series(self, datetime_frame):
tm.assert_series_equal(result, expected)

def test_corrwith_matches_corrcoef(self):
df1 = DataFrame(np.arange(10000), columns=["a"])
df2 = DataFrame(np.arange(10000) ** 2, columns=["a"])
df1 = DataFrame(np.arange(100), columns=["a"])
df2 = DataFrame(np.arange(100) ** 2, columns=["a"])
c1 = df1.corrwith(df2)["a"]
c2 = np.corrcoef(df1["a"], df2["a"])[0][1]

Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/groupby/transform/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def demean(arr):
def test_transform_fast():
df = DataFrame(
{
"id": np.arange(100000) / 3,
"val": np.random.default_rng(2).standard_normal(100000),
"id": np.arange(10) / 3,
"val": np.random.default_rng(2).standard_normal(10),
}
)

Expand Down
15 changes: 5 additions & 10 deletions pandas/tests/indexing/test_chaining_and_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@
msg = "A value is trying to be set on a copy of a slice from a DataFrame"


def random_text(nobs=100):
# Construct a DataFrame where each row is a random slice from 'letters'
idxs = np.random.default_rng(2).integers(len(ascii_letters), size=(nobs, 2))
idxs.sort(axis=1)
strings = [ascii_letters[x[0] : x[1]] for x in idxs]

return DataFrame(strings, columns=["letters"])


class TestCaching:
def test_slice_consolidate_invalidate_item_cache(self):
# this is chained assignment, but will 'work'
Expand Down Expand Up @@ -233,7 +224,11 @@ def test_detect_chained_assignment_is_copy_pickle(self, temp_file):

@pytest.mark.arm_slow
def test_detect_chained_assignment_str(self):
df = random_text(100000)
idxs = np.random.default_rng(2).integers(len(ascii_letters), size=(100, 2))
idxs.sort(axis=1)
strings = [ascii_letters[x[0] : x[1]] for x in idxs]

df = DataFrame(strings, columns=["letters"])
indexer = df.letters.apply(lambda x: len(x) > 10)
df.loc[indexer, "letters"] = df.loc[indexer, "letters"].apply(str.lower)

Expand Down
6 changes: 1 addition & 5 deletions pandas/tests/io/json/test_ujson.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,11 +1036,7 @@ def test_decode_floating_point(self, sign, float_number):
)

def test_encode_big_set(self):
s = set()

for x in range(100000):
s.add(x)

s = set(range(100000))
# Make sure no Exception is raised.
ujson.ujson_dumps(s)

Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/resample/test_datetime_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -1464,12 +1464,12 @@ def test_resample_nunique_with_date_gap(func, unit):
tm.assert_series_equal(result, expected)


@pytest.mark.parametrize("n", [10000, 100000])
@pytest.mark.parametrize("k", [10, 100, 1000])
def test_resample_group_info(n, k, unit):
def test_resample_group_info(unit):
# GH10914

# use a fixed seed to always have the same uniques
n = 100
k = 10
prng = np.random.default_rng(2)

dr = date_range(start="2015-08-27", periods=n // 10, freq="min").as_unit(unit)
Expand Down
Loading