Skip to content

Commit 4ff4e63

Browse files
authored
TST: Add test for pandas on sys.getsizeof GH#21758 (#53385)
Signed-off-by: Liang Yan <[email protected]>
1 parent 8cf4ab4 commit 4ff4e63

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pandas/tests/test_common.py

+16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import collections
22
from functools import partial
33
import string
4+
import subprocess
5+
import sys
46

57
import numpy as np
68
import pytest
@@ -229,3 +231,17 @@ def test_temp_setattr(with_exception):
229231
raise ValueError("Inside exception raised")
230232
raise ValueError("Outside exception raised")
231233
assert ser.name == "first"
234+
235+
236+
def test_str_size():
237+
# GH#21758
238+
a = "a"
239+
expected = sys.getsizeof(a)
240+
pyexe = sys.executable.replace("\\", "/")
241+
call = [
242+
pyexe,
243+
"-c",
244+
"a='a';import sys;sys.getsizeof(a);import pandas;print(sys.getsizeof(a));",
245+
]
246+
result = subprocess.check_output(call).decode()[-4:-1].strip("\n")
247+
assert int(result) == int(expected)

0 commit comments

Comments
 (0)