File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
pandas/tests/plotting/frame Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change 44 date ,
55 datetime ,
66)
7- import gc
87import itertools
98import re
109import string
11- import weakref
1210
1311import numpy as np
1412import pytest
@@ -2164,15 +2162,14 @@ def test_memory_leak(self, kind):
21642162 index = date_range ("2000-01-01" , periods = 10 , freq = "B" ),
21652163 )
21662164
2167- # Use a weakref so we can see if the object gets collected without
2168- # also preventing it from being collected
2169- ref = weakref .ref (df .plot (kind = kind , ** args ))
2170-
2171- # have matplotlib delete all the figures
2172- plt .close ("all" )
2173- # force a garbage collection
2174- gc .collect ()
2175- assert ref () is None
2165+ ax = df .plot (kind = kind , ** args )
2166+ if kind in ["line" , "area" ]:
2167+ for i , (cached_data , _ , _ ) in enumerate (ax ._plot_data ):
2168+ ser = df .iloc [:, i ]
2169+ assert not tm .shares_memory (ser , cached_data )
2170+ tm .assert_numpy_array_equal (ser ._values , cached_data ._values )
2171+ else :
2172+ assert not hasattr (ax , "_plot_data" )
21762173
21772174 def test_df_gridspec_patterns_vert_horiz (self ):
21782175 # GH 10819
You can’t perform that action at this time.
0 commit comments