def lag_sample_test(local_test_dir) -> None:
    """
    Approval test for ShortRateTimeShiftSample.

    The test is successful if output files match git state.
    """

    # Create sample generator record
    sample = LagSample()
    sample.features = ["short_rate", "term_rate"]
    sample.lag_months = 6
    sample.countries = ["C01", "C02"]

    # Create sample
    sample.create_sample(caller_file=__file__)
def two_rate_model_test(local_test_dir) -> None:
    """
    Approval test for TermRateModel with single calibration across all currencies.

    The test is successful if output files match git state.
    """

    country_count: int = 2
    seed = 0
    rand = np.random.RandomState(seed)
    lag_months = 6
    lag_label = DateUtil.get_lag_label(lag_months=lag_months)

    # Perform simulation
    model = ShortRateModel()
    model.year_count = 1
    model.seed = seed
    model.countries = [
        "C" + str(country_index + 1).zfill(4)
        for country_index in range(country_count)
    ]
    model.vol = [0.01] * country_count
    model.rev = [0.2] * country_count
    model.cap_rev = [0.2] * country_count
    model.floor_rev = [0.5] * country_count
    model.soft_cap = [0.10] * country_count
    model.soft_floor = [0.02] * country_count
    model.target = [0.05] * country_count
    model.short_rate_0 = [
        rand.uniform(-0.1, 0.30) for c in range(country_count)
    ]
    model.simulate(caller_file=__file__)

    # Create history plots
    short_rate_plot = LinePlot()
    short_rate_plot.input_files = ["history.short_rate"]
    short_rate_plot.title = "history.short_rate"
    short_rate_plot.save_plot(caller_file=__file__)

    # Create sample with time shift
    sample = LagSample()
    sample.features = ["short_rate"]
    sample.lag_months = lag_months
    sample.create_sample(caller_file=__file__)

    # Create sample plot
    short_rate_plot = ScatterPlot()
    short_rate_plot.input_file = "lag_sample"
    short_rate_plot.columns = ["short_rate(t)", f"short_rate(t{lag_label})"]
    short_rate_plot.title = "lag_sample.short_rate"
    short_rate_plot.save_plot(caller_file=__file__)
    ]
    model.vol = [0.01] * country_count
    model.rev = [0.05] * country_count
    model.cap_rev = [0.2] * country_count
    model.floor_rev = [0.5] * country_count
    model.soft_cap = [0.10] * country_count
    model.soft_floor = [0.02] * country_count
    model.target = [0.05] * country_count
    model.short_rate_0 = [
        rand.uniform(-0.1, 0.30) for c in range(country_count)
    ]
    model.simulate(caller_file=__file__)

    # Create history plots
    short_rate_plot = LinePlot()
    short_rate_plot.input_files = ["history.short_rate"]
    short_rate_plot.title = "history.short_rate"
    short_rate_plot.save_plot(caller_file=__file__)

    # Create sample with time shift
    sample = LagSample()
    sample.features = ["short_rate"]
    sample.lag_months = lag_months
    sample.create_sample(caller_file=__file__)

    # Create sample plot
    short_rate_plot = ScatterPlot()
    short_rate_plot.input_file = "lag_sample"
    short_rate_plot.columns = ["short_rate(t)", f"short_rate(t{lag_label})"]
    short_rate_plot.title = "lag_sample.short_rate"
    short_rate_plot.save_plot(caller_file=__file__)