Skip to content

Commit c6d76dd

Browse files
authored
TST: Reduce some test data sizes (#57897)
TST: Reduce some test sizes
1 parent 78e9f06 commit c6d76dd

File tree

5 files changed

+13
-22
lines changed

5 files changed

+13
-22
lines changed

pandas/tests/frame/methods/test_cov_corr.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,8 @@ def test_corrwith_series(self, datetime_frame):
355355
tm.assert_series_equal(result, expected)
356356

357357
def test_corrwith_matches_corrcoef(self):
358-
df1 = DataFrame(np.arange(10000), columns=["a"])
359-
df2 = DataFrame(np.arange(10000) ** 2, columns=["a"])
358+
df1 = DataFrame(np.arange(100), columns=["a"])
359+
df2 = DataFrame(np.arange(100) ** 2, columns=["a"])
360360
c1 = df1.corrwith(df2)["a"]
361361
c2 = np.corrcoef(df1["a"], df2["a"])[0][1]
362362

pandas/tests/groupby/transform/test_transform.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def demean(arr):
8787
def test_transform_fast():
8888
df = DataFrame(
8989
{
90-
"id": np.arange(100000) / 3,
91-
"val": np.random.default_rng(2).standard_normal(100000),
90+
"id": np.arange(10) / 3,
91+
"val": np.random.default_rng(2).standard_normal(10),
9292
}
9393
)
9494

pandas/tests/indexing/test_chaining_and_caching.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@
1717
msg = "A value is trying to be set on a copy of a slice from a DataFrame"
1818

1919

20-
def random_text(nobs=100):
21-
# Construct a DataFrame where each row is a random slice from 'letters'
22-
idxs = np.random.default_rng(2).integers(len(ascii_letters), size=(nobs, 2))
23-
idxs.sort(axis=1)
24-
strings = [ascii_letters[x[0] : x[1]] for x in idxs]
25-
26-
return DataFrame(strings, columns=["letters"])
27-
28-
2920
class TestCaching:
3021
def test_slice_consolidate_invalidate_item_cache(self):
3122
# this is chained assignment, but will 'work'
@@ -233,7 +224,11 @@ def test_detect_chained_assignment_is_copy_pickle(self, temp_file):
233224

234225
@pytest.mark.arm_slow
235226
def test_detect_chained_assignment_str(self):
236-
df = random_text(100000)
227+
idxs = np.random.default_rng(2).integers(len(ascii_letters), size=(100, 2))
228+
idxs.sort(axis=1)
229+
strings = [ascii_letters[x[0] : x[1]] for x in idxs]
230+
231+
df = DataFrame(strings, columns=["letters"])
237232
indexer = df.letters.apply(lambda x: len(x) > 10)
238233
df.loc[indexer, "letters"] = df.loc[indexer, "letters"].apply(str.lower)
239234

pandas/tests/io/json/test_ujson.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -1036,11 +1036,7 @@ def test_decode_floating_point(self, sign, float_number):
10361036
)
10371037

10381038
def test_encode_big_set(self):
1039-
s = set()
1040-
1041-
for x in range(100000):
1042-
s.add(x)
1043-
1039+
s = set(range(100000))
10441040
# Make sure no Exception is raised.
10451041
ujson.ujson_dumps(s)
10461042

pandas/tests/resample/test_datetime_index.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1464,12 +1464,12 @@ def test_resample_nunique_with_date_gap(func, unit):
14641464
tm.assert_series_equal(result, expected)
14651465

14661466

1467-
@pytest.mark.parametrize("n", [10000, 100000])
1468-
@pytest.mark.parametrize("k", [10, 100, 1000])
1469-
def test_resample_group_info(n, k, unit):
1467+
def test_resample_group_info(unit):
14701468
# GH10914
14711469

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

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

0 commit comments

Comments
 (0)