From 74fec7eeb4e7e2e593ed5e2213020024264681ce Mon Sep 17 00:00:00 2001 From: Ian Foote Date: Tue, 28 Jan 2014 14:30:46 +0000 Subject: Import force_bytes on django >= 1.5 --- rest_framework/tests/test_compat.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 rest_framework/tests/test_compat.py (limited to 'rest_framework/tests') diff --git a/rest_framework/tests/test_compat.py b/rest_framework/tests/test_compat.py new file mode 100644 index 00000000..4916d19b --- /dev/null +++ b/rest_framework/tests/test_compat.py @@ -0,0 +1,13 @@ +import django +from django.test import TestCase + + +class TestCompat(TestCase): + def test_force_bytes_or_smart_bytes(self): + from rest_framework.compat import force_bytes_or_smart_bytes + if django.VERSION >= (1, 5): + from django.utils.encoding import force_bytes + self.assertEqual(force_bytes_or_smart_bytes, force_bytes) + else: + from django.utils.encoding import smart_str + self.assertEqual(force_bytes_or_smart_bytes, smart_str) -- cgit v1.2.3