Commit 99d57df9 by Artem Muterko Committed by Tom Christie

Convert encoders tests to pytest style (#4796)

parent 4dd71d68
......@@ -2,6 +2,7 @@ from datetime import date, datetime, timedelta, tzinfo
from decimal import Decimal
from uuid import uuid4
import pytest
from django.test import TestCase
from rest_framework.compat import coreapi
......@@ -57,7 +58,7 @@ class JSONEncoderTests(TestCase):
current_time = datetime.now().time()
current_time = current_time.replace(tzinfo=UTC())
with self.assertRaises(ValueError):
with pytest.raises(ValueError):
self.encoder.default(current_time)
def test_encode_date(self):
......@@ -85,8 +86,8 @@ class JSONEncoderTests(TestCase):
"""
Tests encoding a coreapi objects raises proper error
"""
with self.assertRaises(RuntimeError):
with pytest.raises(RuntimeError):
self.encoder.default(coreapi.Document())
with self.assertRaises(RuntimeError):
with pytest.raises(RuntimeError):
self.encoder.default(coreapi.Error())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment