Exemple #1
0
def test_get_deprecation_messages(deprecation_messages):
    for d in deprecation_messages:
        deprecate(**d)

    accessor_deprecations = get_deprecation_messages()
    assert isinstance(accessor_deprecations, tuple)
    assert len(accessor_deprecations) == 7
Exemple #2
0
def test_deprecate_failure(test_case):
    with pytest.raises(TypeError, match='deprecate requires a string not a %s' % type(test_case)):
        deprecate(test_case)
Exemple #3
0
def test_multiple_deprecations(deprecation_messages):
    for d in deprecation_messages:
        deprecate(**d)

    assert deprecation_messages == warnings._global_deprecations
Exemple #4
0
def test_deprecate_with_date_and_collection():
    deprecate(msg='Deprecation message', date='2199-12-31', collection_name='assible.builtin')
    assert warnings._global_deprecations == [
        {'msg': 'Deprecation message', 'date': '2199-12-31', 'collection_name': 'assible.builtin'}]
Exemple #5
0
def test_deprecate_with_date():
    deprecate(msg='Deprecation message', date='2199-12-31')
    assert warnings._global_deprecations == [
        {'msg': 'Deprecation message', 'date': '2199-12-31', 'collection_name': None}]
Exemple #6
0
def test_deprecate_with_version_and_collection():
    deprecate(msg='Deprecation message', version='2.14', collection_name='assible.builtin')
    assert warnings._global_deprecations == [
        {'msg': 'Deprecation message', 'version': '2.14', 'collection_name': 'assible.builtin'}]
Exemple #7
0
def test_deprecate_with_version():
    deprecate(msg='Deprecation message', version='2.14')
    assert warnings._global_deprecations == [
        {'msg': 'Deprecation message', 'version': '2.14', 'collection_name': None}]
Exemple #8
0
def test_deprecate_message_only():
    deprecate('Deprecation message')
    assert warnings._global_deprecations == [
        {'msg': 'Deprecation message', 'version': None, 'collection_name': None}]