# This test script was automatically generated by the contrib-patch-tests.py
# script. If you want to make changes to it, you should make sure that you have
# removed the ``_generated`` suffix from the file name, to prevent the content
# from being overwritten by future re-generations.

from ddtrace.contrib.internal.ddtrace_api.patch import get_version
from ddtrace.contrib.internal.ddtrace_api.patch import patch
from ddtrace.contrib.internal.ddtrace_api.patch import unpatch
from tests.contrib.patch import PatchTestCase


class TestDDTraceAPIPatch(PatchTestCase.Base):
    __integration_name__ = "ddtrace_api"
    __module_name__ = "ddtrace_api"
    __patch_func__ = patch
    __unpatch_func__ = unpatch
    __get_version__ = get_version

    def assert_module_patched(self, ddtrace_api):
        assert hasattr(ddtrace_api, "__datadog_patch")
        assert getattr(ddtrace_api, "__datadog_patch") is True

    def assert_not_module_patched(self, ddtrace_api):
        assert getattr(ddtrace_api, "__datadog_patch", None) in (None, False)

    def assert_not_module_double_patched(self, ddtrace_api):
        assert hasattr(ddtrace_api, "__datadog_patch")
        assert getattr(ddtrace_api, "__datadog_patch") is True
