mirror of https://github.com/mahmoud/boltons.git
Import ABC from collections.abc instead of collections for Python 3.9 compatibility.
This commit is contained in:
parent
eefa5ee604
commit
98ef3be292
|
@ -88,7 +88,10 @@ class BasicRender(object):
|
|||
self.autotable_render = AutoTableRenderer()
|
||||
|
||||
def render_response(self, request, context, _route):
|
||||
from collections import Sized
|
||||
try:
|
||||
from collections.abc import Sized
|
||||
except ImportError:
|
||||
from collections import Sized
|
||||
if isinstance(context, basestring): # already serialized
|
||||
if self._guess_json(context):
|
||||
return Response(context, mimetype="application/json")
|
||||
|
|
|
@ -88,10 +88,14 @@ def test_clear():
|
|||
|
||||
|
||||
def test_types():
|
||||
import collections
|
||||
try:
|
||||
from collections.abc import MutableMapping
|
||||
except ImportError:
|
||||
from collections import MutableMapping
|
||||
|
||||
omd = OMD()
|
||||
assert isinstance(omd, dict)
|
||||
assert isinstance(omd, collections.MutableMapping)
|
||||
assert isinstance(omd, MutableMapping)
|
||||
|
||||
|
||||
def test_multi_correctness():
|
||||
|
|
Loading…
Reference in New Issue