diff --git a/econml/tests/test_causal_analysis.py b/econml/tests/test_causal_analysis.py index f99c648d0..4293f3233 100644 --- a/econml/tests/test_causal_analysis.py +++ b/econml/tests/test_causal_analysis.py @@ -9,6 +9,7 @@ from numpy.core.fromnumeric import squeeze import pandas as pd import pytest +import gc from econml.solutions.causal_analysis import CausalAnalysis from econml.solutions.causal_analysis._causal_analysis import _CausalInsightsConstants @@ -692,6 +693,9 @@ def test_random_state(self): np.testing.assert_equal(glo.point.values, glo2.point.values) np.testing.assert_equal(glo.stderr.values, glo2.stderr.values) + del ca, glo, ca2, glo2 + gc.collect() + def test_can_set_categories(self): y = pd.Series(np.random.choice([0, 1], size=(500,))) X = pd.DataFrame({'a': np.random.normal(size=500), @@ -785,6 +789,9 @@ def test_invalid_inds(self): self.assertEqual(ca.untrained_feature_indices_, [(4, 'cat_limit'), (5, 'cat_limit')]) + del ca + gc.collect() + # Add tests that guarantee that the reliance on DML feature order is not broken, such as # Creare a transformer that zeros out all variables after the first n_x variables, so it zeros out W # Pass an example where W is irrelevant and X is confounder