mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-28 20:44:03 +03:00
parent
f148e4e259
commit
2ebd479759
|
@ -91,6 +91,9 @@ class ErrorDetail(six.text_type):
|
||||||
self.code,
|
self.code,
|
||||||
))
|
))
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash(str(self))
|
||||||
|
|
||||||
|
|
||||||
class APIException(Exception):
|
class APIException(Exception):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -81,6 +81,10 @@ class ErrorDetailTests(TestCase):
|
||||||
assert str(ErrorDetail('msg1')) == 'msg1'
|
assert str(ErrorDetail('msg1')) == 'msg1'
|
||||||
assert str(ErrorDetail('msg1', 'code')) == 'msg1'
|
assert str(ErrorDetail('msg1', 'code')) == 'msg1'
|
||||||
|
|
||||||
|
def test_hash(self):
|
||||||
|
assert hash(ErrorDetail('msg')) == hash('msg')
|
||||||
|
assert hash(ErrorDetail('msg', 'code')) == hash('msg')
|
||||||
|
|
||||||
|
|
||||||
class TranslationTests(TestCase):
|
class TranslationTests(TestCase):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user