@@ -725,122 +725,3 @@ def test_inverse_prop():
725725 assert all (isinstance (ax , plt .Axes ) for ax in axs )
726726 with pytest .raises (NotImplementedError ):
727727 result .get_plot_data ()
728-
729-
730- # DEPRECATION WARNING TESTS ============================================================
731-
732-
733- def test_did_deprecation_warning ():
734- """Test that the old DifferenceInDifferences class raises a deprecation warning."""
735-
736- with pytest .warns (DeprecationWarning ):
737- df = cp .load_data ("did" )
738- result = cp .pymc_experiments .DifferenceInDifferences (
739- df ,
740- formula = "y ~ 1 + group*post_treatment" ,
741- time_variable_name = "t" ,
742- group_variable_name = "group" ,
743- model = cp .pymc_models .LinearRegression (sample_kwargs = sample_kwargs ),
744- )
745- assert isinstance (result , cp .DifferenceInDifferences )
746-
747-
748- def test_rd_deprecation_warning ():
749- """Test that the old RegressionDiscontinuity class raises a deprecation warning."""
750-
751- with pytest .warns (DeprecationWarning ):
752- df = cp .load_data ("rd" )
753- result = cp .pymc_experiments .RegressionDiscontinuity (
754- df ,
755- formula = "y ~ 1 + bs(x, df=6) + treated" ,
756- model = cp .pymc_models .LinearRegression (sample_kwargs = sample_kwargs ),
757- treatment_threshold = 0.5 ,
758- epsilon = 0.001 ,
759- )
760- assert isinstance (result , cp .RegressionDiscontinuity )
761-
762-
763- def test_rk_deprecation_warning ():
764- """Test that the old RegressionKink class raises a deprecation warning."""
765-
766- with pytest .warns (DeprecationWarning ):
767- kink = 0.5
768- df = setup_regression_kink_data (kink )
769- result = cp .pymc_experiments .RegressionKink (
770- df ,
771- formula = f"y ~ 1 + x + I((x-{ kink } )*treated)" ,
772- model = cp .pymc_models .LinearRegression (sample_kwargs = sample_kwargs ),
773- kink_point = kink ,
774- )
775- assert isinstance (result , cp .RegressionKink )
776-
777-
778- def test_its_deprecation_warning ():
779- """Test that the old InterruptedTimeSeries class raises a deprecation warning."""
780-
781- with pytest .warns (DeprecationWarning ):
782- df = (
783- cp .load_data ("its" )
784- .assign (date = lambda x : pd .to_datetime (x ["date" ]))
785- .set_index ("date" )
786- )
787- treatment_time = pd .to_datetime ("2017-01-01" )
788- result = cp .pymc_experiments .InterruptedTimeSeries (
789- df ,
790- treatment_time ,
791- formula = "y ~ 1 + t + C(month)" ,
792- model = cp .pymc_models .LinearRegression (sample_kwargs = sample_kwargs ),
793- )
794- assert isinstance (result , cp .InterruptedTimeSeries )
795-
796-
797- def test_sc_deprecation_warning ():
798- """Test that the old SyntheticControl class raises a deprecation warning."""
799-
800- with pytest .warns (DeprecationWarning ):
801- df = cp .load_data ("sc" )
802- treatment_time = 70
803- result = cp .pymc_experiments .SyntheticControl (
804- df ,
805- treatment_time ,
806- control_units = ["a" , "b" , "c" , "d" , "e" , "f" , "g" ],
807- treated_units = ["actual" ],
808- model = cp .pymc_models .WeightedSumFitter (sample_kwargs = sample_kwargs ),
809- )
810- assert isinstance (result , cp .SyntheticControl )
811-
812-
813- def test_ancova_deprecation_warning ():
814- """Test that the old PrePostNEGD class raises a deprecation warning."""
815-
816- with pytest .warns (DeprecationWarning ):
817- df = cp .load_data ("anova1" )
818- result = cp .pymc_experiments .PrePostNEGD (
819- df ,
820- formula = "post ~ 1 + C(group) + pre" ,
821- group_variable_name = "group" ,
822- pretreatment_variable_name = "pre" ,
823- model = cp .pymc_models .LinearRegression (sample_kwargs = sample_kwargs ),
824- )
825- assert isinstance (result , cp .PrePostNEGD )
826-
827-
828- def test_iv_deprecation_warning ():
829- """Test that the old InstrumentalVariable class raises a deprecation warning."""
830-
831- with pytest .warns (DeprecationWarning ):
832- df = cp .load_data ("risk" )
833- instruments_formula = "risk ~ 1 + logmort0"
834- formula = "loggdp ~ 1 + risk"
835- instruments_data = df [["risk" , "logmort0" ]]
836- data = df [["loggdp" , "risk" ]]
837- result = cp .pymc_experiments .InstrumentalVariable (
838- instruments_data = instruments_data ,
839- data = data ,
840- instruments_formula = instruments_formula ,
841- formula = formula ,
842- model = cp .pymc_models .InstrumentalVariableRegression (
843- sample_kwargs = sample_kwargs
844- ),
845- )
846- assert isinstance (result , cp .InstrumentalVariable )
0 commit comments