Ejemplo n.º 1
0
def test_raise_deprecation_warning_default():
    with pytest.warns(FutureWarning) as record:
        raise_deprecation_warning("This feature is deprecated.")

    assert len(record) == 1
    assert record[0].message.args[0] == (
        f"This feature is deprecated. "
        f"(will be removed in {NEXT_MAJOR_VERSION_FOR_DEPRECATIONS})")
Ejemplo n.º 2
0
def test_raise_deprecation_warning():
    with pytest.warns(FutureWarning) as record:
        raise_deprecation_warning("This feature is deprecated.",
                                  warn_until_version="3.0.0")

    assert len(record) == 1
    assert (record[0].message.args[0] ==
            "This feature is deprecated. (will be removed in 3.0.0)")
Ejemplo n.º 3
0
def test_raise_deprecation_warning_version_already_in_message():
    with pytest.warns(FutureWarning) as record:
        raise_deprecation_warning(
            "This feature is deprecated and will be removed in 3.0.0!",
            warn_until_version="3.0.0",
        )

    assert len(record) == 1
    assert (record[0].message.args[0] ==
            "This feature is deprecated and will be removed in 3.0.0!")