mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Convert encoders tests to pytest style (#4796)
This commit is contained in:
parent
4dd71d68d2
commit
99d57df990
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue
Block a user