From 99d57df990736b882ecafd033bb158a2d2cec0a8 Mon Sep 17 00:00:00 2001 From: Artem Muterko Date: Sun, 8 Jan 2017 18:10:47 +0200 Subject: [PATCH] Convert encoders tests to pytest style (#4796) --- tests/test_encoders.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_encoders.py b/tests/test_encoders.py index 403b1e9b2..5c6915d0c 100644 --- a/tests/test_encoders.py +++ b/tests/test_encoders.py @@ -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())