# Path: rest_framework_extensions/utils.py
# def prepare_header_name(name):
#     """
#     >> prepare_header_name('Accept-Language')
#     http_accept_language
#     """
#     return 'http_{0}'.format(name.strip().replace('-', '_')).upper()
# 
# def get_rest_framework_version():
#     return tuple(LooseVersion(rest_framework.VERSION).version)


import contextlib
    import mock
    from unittest import mock
from django.test import TestCase
from rest_framework_extensions.utils import prepare_header_name, get_rest_framework_version
try:
except ImportError:




@contextlib.contextmanager
def parsed_version(version):
    with mock.patch('rest_framework.VERSION', version):
        yield get_rest_framework_version()


class TestPrepareHeaderName(TestCase):
    def test_upper(self):
        self.assertEqual(prepare_header_name('Accept'), 'HTTP_ACCEPT')

    def test_replace_dash_with_underscores(self):
        self.assertEqual(
            prepare_header_name('Accept-Language'), 'HTTP_ACCEPT_LANGUAGE')

    def test_strips_whitespaces(self):
        self.assertEqual(
            prepare_header_name('  Accept-Language  '), 'HTTP_ACCEPT_LANGUAGE')

    def test_adds_http_prefix(self):
        self.assertEqual(

# Path: rest_framework_extensions/utils.py
# def prepare_header_name(name):
#     """
#     >> prepare_header_name('Accept-Language')
#     http_accept_language
#     """
#     return 'http_{0}'.format(name.strip().replace('-', '_')).upper()
# 
# def get_rest_framework_version():
#     return tuple(LooseVersion(rest_framework.VERSION).version)


# Path: tests_app/tests/unit/utils/tests.py
import contextlib
    import mock
    from unittest import mock
from django.test import TestCase
from rest_framework_extensions.utils import prepare_header_name, get_rest_framework_version

try:
except ImportError:




@contextlib.contextmanager
def parsed_version(version):
    with mock.patch('rest_framework.VERSION', version):
        yield get_rest_framework_version()


class TestPrepareHeaderName(TestCase):
    def test_upper(self):
        self.assertEqual(prepare_header_name('Accept'), 'HTTP_ACCEPT')

    def test_replace_dash_with_underscores(self):
        self.assertEqual(
            prepare_header_name('Accept-Language'), 'HTTP_ACCEPT_LANGUAGE')

    def test_strips_whitespaces(self):
        self.assertEqual(
            prepare_header_name('  Accept-Language  '), 'HTTP_ACCEPT_LANGUAGE')

    def test_adds_http_prefix(self):
        self.assertEqual(

            prepare_header_name('Accept-Language'), 'HTTP_ACCEPT_LANGUAGE')