make[2]: Entering directory '/<<PKGBUILDDIR>>/docs'en/master/usage/extensions/intersphinx.html#confval-intersphinx_mapping
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v7.2.6
making output directory... done
WARNING: The pre-Sphinx 1.0 'intersphinx_mapping' format is deprecated and will be removed in Sphinx 8. Update to the current format as described in the documentation. Hint: "intersphinx_mapping = {'<name>': ('six', None)}".https://www.sphinx-doc.org/
loading intersphinx inventory from /usr/share/doc/python-flask-doc/html/objects.inv...
WARNING: failed to reach any of the inventories with the following issues: intersphinx inventory '/usr/share/doc/python-flask-doc/html/objects.inv' not fetchable due to <class 'FileNotFoundError'>: [Errno 2] No such file or directory: '/usr/share/doc/python-flask-doc/html/objects.inv'
loading intersphinx inventory from /usr/share/doc/python-werkzeug-doc/html/objects.inv...
WARNING: failed to reach any of the inventories with the following issues: intersphinx inventory '/usr/share/doc/python-werkzeug-doc/html/objects.inv' not fetchable due to <class 'FileNotFoundError'>: [Errno 2] No such file or directory: '/usr/share/doc/python-werkzeug-doc/html/objects.inv'
loading intersphinx inventory from /usr/share/doc/python3-doc/html/objects.inv...
loading intersphinx inventory from /usr/share/doc/python3-doc/html/objects.inv...
loading intersphinx inventory from six/objects.inv...
WARNING: failed to reach any of the inventories with the following issues: intersphinx inventory 'six/objects.inv' not fetchable due to <class 'FileNotFoundError'>: [Errno 2] No such file or directory: '/<<PKGBUILDDIR>>/docs/six/objects.inv'
building [mo]: targets for 0 po files that are out of date
writing output...
building [html]: targets for 9 source files that are out of date
updating environment: [new config] 9 added, 0 changed, 0 removed
reading sources... [ 11%] api
reading sources... [ 22%] extending
reading sources... [ 33%] fields
reading sources... [ 44%] index
reading sources... [ 56%] installation
reading sources... [ 67%] intermediate-usage
reading sources... [ 78%] quickstart
reading sources... [ 89%] reqparse
reading sources... [100%] testing
/<<PKGBUILDDIR>>/flask_restful/__init__.py:docstring of flask_restful.Api.unauthorized:1: WARNING: duplicate object description of flask_restful.Api.unauthorized, other instance in api, use :no-index: for one of them
/<<PKGBUILDDIR>>/docs/index.rst:6: WARNING: duplicate object description of flask_restful, other instance in api, use :no-index: for one of them
/<<PKGBUILDDIR>>/docs/reqparse.rst:217: WARNING: Explicit markup ends without a blank line; unexpected unindent.
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets... copying static files... done
copying extra files... done
done
writing output... [ 11%] api
writing output... [ 22%] extending
writing output... [ 33%] fields
writing output... [ 44%] index
writing output... [ 56%] installation
writing output... [ 67%] intermediate-usage
writing output... [ 78%] quickstart
writing output... [ 89%] reqparse
writing output... [100%] testing
/<<PKGBUILDDIR>>/docs/intermediate-usage.rst:80: WARNING: undefined label: 'blueprints'
generating indices... genindex py-modindex done
writing additional pages... search done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 8 warnings.
The HTML pages are in _build/html.
Build finished. The HTML pages are in _build/html.
make[2]: Leaving directory '/<<PKGBUILDDIR>>/docs'
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
dh_auto_test -O--buildsystem=pybuild
I: pybuild base:305: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_flask-restful/build; python3.12 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.12.1, pytest-7.4.4, pluggy-1.3.0
rootdir: /<<PKGBUILDDIR>>
collected 318 items
tests/test_accept.py ............ [ 3%]
tests/test_api.py x.....................F............................... [ 20%]
.......FF................... [ 29%]
tests/test_api_with_blueprint.py ............. [ 33%]
tests/test_cors.py .... [ 34%]
tests/test_fields.py xxxx............................................... [ 50%]
.................... [ 57%]
tests/test_inputs.py xxxxxxx.xx.....................x.x [ 67%]
tests/test_reqparse.py ................................................. [ 83%]
...F....................................FF........... [100%]
=================================== FAILURES ===================================
_____________ APITestCase.test_error_router_falls_back_to_original _____________
self = <tests.test_api.APITestCase testMethod=test_error_router_falls_back_to_original>
def test_error_router_falls_back_to_original(self):
"""Verify that if an exception occurs in the Flask-RESTful error handler,
the error_router will call the original flask error handler instead.
"""
app = Flask(__name__)
api = flask_restful.Api(app)
app.handle_exception = Mock()
api.handle_error = Mock(side_effect=Exception())
api._has_fr_route = Mock(return_value=True)
exception = Mock(spec=HTTPException)
with app.test_request_context('/foo'):
api.error_router(exception, app.handle_exception)
self.assertTrue(app.handle_exception.called_with(exception))
tests/test_api.py:509:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Mock id='139839121758240'>, name = 'called_with'
def __getattr__(self, name):
if name in {'_mock_methods', '_mock_unsafe'}:
raise AttributeError(name)
elif self._mock_methods is not None:
if name not in self._mock_methods or name in _all_magics:
raise AttributeError("Mock object has no attribute %r" % name)
elif _is_magic(name):
raise AttributeError(name)
if not self._mock_unsafe and (not self._mock_methods or name not in self._mock_methods):
if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')) or name in _ATTRIB_DENY_LIST:
raise AttributeError(f"{name!r} is not a valid assertion. Use a spec "
f"for the mock if {name!r} is meant to be an attribute.") E AttributeError: 'called_with' is not a valid assertion. Use a spec for the mock if 'called_with' is meant to be an attribute.
/usr/lib/python3/dist-packages/mock/mock.py:695: AttributeError _____________________ APITestCase.test_media_types_method ______________________
self = <tests.test_api.APITestCase testMethod=test_media_types_method>
def test_media_types_method(self):
app = Flask(__name__)
api = flask_restful.Api(app)
with app.test_request_context("/foo", headers={
'Accept': 'application/xml; q=.5'
}):
self.assertEqual(api.mediatypes_method()(Mock()),['application/xml', 'application/json'])
E AssertionError: Lists differ: ['application/json'] != ['application/xml', 'application/json']
E
E First differing element 0:
E 'application/json'
E 'application/xml'
E
E Second list contains 1 additional elements.
E First extra element 1:
E 'application/json'
E
E - ['application/json']
E + ['application/xml', 'application/json']
tests/test_api.py:527: AssertionError
________________________ APITestCase.test_media_types_q ________________________
self = <tests.test_api.APITestCase testMethod=test_media_types_q>
def test_media_types_q(self):
app = Flask(__name__)
api = flask_restful.Api(app)
with app.test_request_context("/foo", headers={
'Accept': 'application/json; q=1, application/xml; q=.5'
}):
self.assertEqual(api.mediatypes(),['application/json', 'application/xml'])
E AssertionError: Lists differ: ['application/json'] != ['application/json', 'application/xml']
E
E Second list contains 1 additional elements.
E First extra element 1:
E 'application/xml'
E
E - ['application/json']
E + ['application/json', 'application/xml']
tests/test_api.py:537: AssertionError
_____________________ ReqParseTestCase.test_parse_choices ______________________
self = <tests.test_reqparse.ReqParseTestCase testMethod=test_parse_choices>
def test_parse_choices(self):
app = Flask(__name__)
with app.app_context():
req = Request.from_values("/bubble?foo=bar")
parser = RequestParser()
parser.add_argument("foo", choices=["bat"]),
self.assertRaises(exceptions.BadRequest, lambda: parser.parse_args(req))
tests/test_reqparse.py:547:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_reqparse.py:547: in <lambda>
self.assertRaises(exceptions.BadRequest, lambda: parser.parse_args(req)) flask_restful/reqparse.py:328: in parse_args
value, found = arg.parse(req, self.bundle_errors) flask_restful/reqparse.py:184: in parse
source = self.source(request)
flask_restful/reqparse.py:125: in source
value = getattr(request, l, None) /usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:561: in json
return self.get_json() /usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:607: in get_json
return self.on_json_loading_failed(None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def on_json_loading_failed(self, e: ValueError | None) -> t.Any:
"""Called if :meth:`get_json` fails and isn't silenced.
If this method returns a value, it is used as the return value
for :meth:`get_json`. The default implementation raises
:exc:`~werkzeug.exceptions.BadRequest`.
:param e: If parsing failed, this is the exception. It will be
``None`` if the content type wasn't ``application/json``.
.. versionchanged:: 2.3
Raise a 415 error instead of 400.
"""
if e is not None:
raise BadRequest(f"Failed to decode JSON object: {e}")
raise UnsupportedMediaType("Did not attempt to load JSON data because the request"
" Content-Type was not 'application/json'."
)
E werkzeug.exceptions.UnsupportedMediaType: 415 Unsupported Media Type: Did not attempt to load JSON data because the request Content-Type was not 'application/json'.
/usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:650: UnsupportedMediaType
___________________ ReqParseTestCase.test_strict_parsing_on ____________________
self = <tests.test_reqparse.ReqParseTestCase testMethod=test_strict_parsing_on>
def test_strict_parsing_on(self):
req = Request.from_values("/bubble?foo=baz")
parser = RequestParser()
self.assertRaises(exceptions.BadRequest, parser.parse_args, req, strict=True)
tests/test_reqparse.py:823:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_restful/reqparse.py:325: in parse_args
req.unparsed_arguments = dict(self.argument_class('').source(req)) if strict else {}
flask_restful/reqparse.py:125: in source
value = getattr(request, l, None) /usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:561: in json
return self.get_json() /usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:607: in get_json
return self.on_json_loading_failed(None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def on_json_loading_failed(self, e: ValueError | None) -> t.Any:
"""Called if :meth:`get_json` fails and isn't silenced.
If this method returns a value, it is used as the return value
for :meth:`get_json`. The default implementation raises
:exc:`~werkzeug.exceptions.BadRequest`.
:param e: If parsing failed, this is the exception. It will be
``None`` if the content type wasn't ``application/json``.
.. versionchanged:: 2.3
Raise a 415 error instead of 400.
"""
if e is not None:
raise BadRequest(f"Failed to decode JSON object: {e}")
raise UnsupportedMediaType("Did not attempt to load JSON data because the request"
" Content-Type was not 'application/json'."
)
E werkzeug.exceptions.UnsupportedMediaType: 415 Unsupported Media Type: Did not attempt to load JSON data because the request Content-Type was not 'application/json'.
/usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:650: UnsupportedMediaType
_____________ ReqParseTestCase.test_strict_parsing_on_partial_hit ______________
self = <tests.test_reqparse.ReqParseTestCase testMethod=test_strict_parsing_on_partial_hit>
def test_strict_parsing_on_partial_hit(self):
req = Request.from_values("/bubble?foo=1&bar=bees&n=22")
parser = RequestParser()
parser.add_argument('foo', type=int, location="args")
self.assertRaises(exceptions.BadRequest, parser.parse_args, req, strict=True)
tests/test_reqparse.py:836:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_restful/reqparse.py:325: in parse_args
req.unparsed_arguments = dict(self.argument_class('').source(req)) if strict else {}
flask_restful/reqparse.py:125: in source
value = getattr(request, l, None) /usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:561: in json
return self.get_json() /usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:607: in get_json
return self.on_json_loading_failed(None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def on_json_loading_failed(self, e: ValueError | None) -> t.Any:
"""Called if :meth:`get_json` fails and isn't silenced.
If this method returns a value, it is used as the return value
for :meth:`get_json`. The default implementation raises
:exc:`~werkzeug.exceptions.BadRequest`.
:param e: If parsing failed, this is the exception. It will be
``None`` if the content type wasn't ``application/json``.
.. versionchanged:: 2.3
Raise a 415 error instead of 400.
"""
if e is not None:
raise BadRequest(f"Failed to decode JSON object: {e}")
raise UnsupportedMediaType("Did not attempt to load JSON data because the request"
" Content-Type was not 'application/json'."
)
E werkzeug.exceptions.UnsupportedMediaType: 415 Unsupported Media Type: Did not attempt to load JSON data because the request Content-Type was not 'application/json'.
/usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:650: UnsupportedMediaType
=============================== warnings summary ===============================
.pybuild/cpython3_3.12_flask-restful/build/tests/test_api.py:28
.pybuild/cpython3_3.12_flask-restful/build/tests/test_api.py:28: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_unpack will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_fields.py:28
.pybuild/cpython3_3.12_flask-restful/build/tests/test_fields.py:28: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_float will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_fields.py:38
.pybuild/cpython3_3.12_flask-restful/build/tests/test_fields.py:38: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_boolean will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_fields.py:50
.pybuild/cpython3_3.12_flask-restful/build/tests/test_fields.py:50: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_rfc822_datetime_formatters will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_fields.py:64
.pybuild/cpython3_3.12_flask-restful/build/tests/test_fields.py:64: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_iso8601_datetime_formatters will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:14
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:14: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_reverse_rfc822_datetime will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:25
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:25: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_reverse_iso8601_datetime will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:37
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:37: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_urls will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:69
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:69: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_bad_urls will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:91
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:91: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_bad_url_error_message will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:112
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:112: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_regex_bad_input will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:126
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:126: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_regex_good_input will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:144
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:144: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_regex_flags_good_input will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:157
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:157: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_regex_flags_bad_input will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:243
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:243: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_isointerval will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:410
.pybuild/cpython3_3.12_flask-restful/build/tests/test_inputs.py:410: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_bad_isointervals will be ignored
.pybuild/cpython3_3.12_flask-restful/build/tests/test_api.py::APITestCase::test_custom_error_message
.pybuild/cpython3_3.12_flask-restful/build/tests/test_api.py::APITestCase::test_handle_error_with_code
.pybuild/cpython3_3.12_flask-restful/build/tests/test_api.py::APITestCase::test_handle_server_error
/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_flask-restful/build/flask_restful/__init__.py:283: DeprecationWarning: 'propagate_exceptions' is deprecated and will be removed in Flask 2.3.
if not isinstance(e, HTTPException) and current_app.propagate_exceptions:
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================
FAILED tests/test_api.py::APITestCase::test_error_router_falls_back_to_original
FAILED tests/test_api.py::APITestCase::test_media_types_method - AssertionErr...
FAILED tests/test_api.py::APITestCase::test_media_types_q - AssertionError: L...
FAILED tests/test_reqparse.py::ReqParseTestCase::test_parse_choices - werkzeu...
FAILED tests/test_reqparse.py::ReqParseTestCase::test_strict_parsing_on - wer...
FAILED tests/test_reqparse.py::ReqParseTestCase::test_strict_parsing_on_partial_hit
============ 6 failed, 296 passed, 16 xfailed, 19 warnings in 1.36s ============
E: pybuild pybuild:391: test: plugin distutils failed with: exit code=1: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_flask-restful/build; python3.12 -m pytest tests
I: pybuild base:305: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_flask-restful/build; python3.11 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.11.7, pytest-7.4.4, pluggy-1.3.0
rootdir: /<<PKGBUILDDIR>>
collected 318 items
tests/test_accept.py ............ [ 3%]
tests/test_api.py x.....................F............................... [ 20%]
.......FF................... [ 29%]
tests/test_api_with_blueprint.py ............. [ 33%]
tests/test_cors.py .... [ 34%]
tests/test_fields.py xxxx............................................... [ 50%]
.................... [ 57%]
tests/test_inputs.py xxxxxxx.xx.....................x.x [ 67%]
tests/test_reqparse.py ................................................. [ 83%]
...F....................................FF........... [100%]
=================================== FAILURES ===================================
_____________ APITestCase.test_error_router_falls_back_to_original _____________
self = <tests.test_api.APITestCase testMethod=test_error_router_falls_back_to_original>
def test_error_router_falls_back_to_original(self):
"""Verify that if an exception occurs in the Flask-RESTful error handler,
the error_router will call the original flask error handler instead.
"""
app = Flask(__name__)
api = flask_restful.Api(app)
app.handle_exception = Mock()
api.handle_error = Mock(side_effect=Exception())
api._has_fr_route = Mock(return_value=True)
exception = Mock(spec=HTTPException)
with app.test_request_context('/foo'):
api.error_router(exception, app.handle_exception)
self.assertTrue(app.handle_exception.called_with(exception))
tests/test_api.py:509:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Mock id='140473142266896'>, name = 'called_with'
def __getattr__(self, name):
if name in {'_mock_methods', '_mock_unsafe'}:
raise AttributeError(name)
elif self._mock_methods is not None:
if name not in self._mock_methods or name in _all_magics:
raise AttributeError("Mock object has no attribute %r" % name)
elif _is_magic(name):
raise AttributeError(name)
if not self._mock_unsafe and (not self._mock_methods or name not in self._mock_methods):
if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')) or name in _ATTRIB_DENY_LIST:
raise AttributeError(f"{name!r} is not a valid assertion. Use a spec "
f"for the mock if {name!r} is meant to be an attribute.") E AttributeError: 'called_with' is not a valid assertion. Use a spec for the mock if 'called_with' is meant to be an attribute.
/usr/lib/python3/dist-packages/mock/mock.py:695: AttributeError _____________________ APITestCase.test_media_types_method ______________________
self = <tests.test_api.APITestCase testMethod=test_media_types_method>
def test_media_types_method(self):
app = Flask(__name__)
api = flask_restful.Api(app)
with app.test_request_context("/foo", headers={
'Accept': 'application/xml; q=.5'
}):
self.assertEqual(api.mediatypes_method()(Mock()),['application/xml', 'application/json'])
E AssertionError: Lists differ: ['application/json'] != ['application/xml', 'application/json']
E
E First differing element 0:
E 'application/json'
E 'application/xml'
E
E Second list contains 1 additional elements.
E First extra element 1:
E 'application/json'
E
E - ['application/json']
E + ['application/xml', 'application/json']
tests/test_api.py:527: AssertionError
________________________ APITestCase.test_media_types_q ________________________
self = <tests.test_api.APITestCase testMethod=test_media_types_q>
def test_media_types_q(self):
app = Flask(__name__)
api = flask_restful.Api(app)
with app.test_request_context("/foo", headers={
'Accept': 'application/json; q=1, application/xml; q=.5'
}):
self.assertEqual(api.mediatypes(),['application/json', 'application/xml'])
E AssertionError: Lists differ: ['application/json'] != ['application/json', 'application/xml']
E
E Second list contains 1 additional elements.
E First extra element 1:
E 'application/xml'
E
E - ['application/json']
E + ['application/json', 'application/xml']
tests/test_api.py:537: AssertionError
_____________________ ReqParseTestCase.test_parse_choices ______________________
self = <tests.test_reqparse.ReqParseTestCase testMethod=test_parse_choices>
def test_parse_choices(self):
app = Flask(__name__)
with app.app_context():
req = Request.from_values("/bubble?foo=bar")
parser = RequestParser()
parser.add_argument("foo", choices=["bat"]),
self.assertRaises(exceptions.BadRequest, lambda: parser.parse_args(req))
tests/test_reqparse.py:547:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_reqparse.py:547: in <lambda>
self.assertRaises(exceptions.BadRequest, lambda: parser.parse_args(req)) flask_restful/reqparse.py:328: in parse_args
value, found = arg.parse(req, self.bundle_errors) flask_restful/reqparse.py:184: in parse
source = self.source(request)
flask_restful/reqparse.py:125: in source
value = getattr(request, l, None) /usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:561: in json
return self.get_json() /usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:607: in get_json
return self.on_json_loading_failed(None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def on_json_loading_failed(self, e: ValueError | None) -> t.Any:
"""Called if :meth:`get_json` fails and isn't silenced.
If this method returns a value, it is used as the return value
for :meth:`get_json`. The default implementation raises
:exc:`~werkzeug.exceptions.BadRequest`.
:param e: If parsing failed, this is the exception. It will be
``None`` if the content type wasn't ``application/json``.
.. versionchanged:: 2.3
Raise a 415 error instead of 400.
"""
if e is not None:
raise BadRequest(f"Failed to decode JSON object: {e}")
raise UnsupportedMediaType("Did not attempt to load JSON data because the request"
" Content-Type was not 'application/json'."
)
E werkzeug.exceptions.UnsupportedMediaType: 415 Unsupported Media Type: Did not attempt to load JSON data because the request Content-Type was not 'application/json'.
/usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:650: UnsupportedMediaType
___________________ ReqParseTestCase.test_strict_parsing_on ____________________
self = <tests.test_reqparse.ReqParseTestCase testMethod=test_strict_parsing_on>
def test_strict_parsing_on(self):
req = Request.from_values("/bubble?foo=baz")
parser = RequestParser()
self.assertRaises(exceptions.BadRequest, parser.parse_args, req, strict=True)
tests/test_reqparse.py:823:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_restful/reqparse.py:325: in parse_args
req.unparsed_arguments = dict(self.argument_class('').source(req)) if strict else {}
flask_restful/reqparse.py:125: in source
value = getattr(request, l, None) /usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:561: in json
return self.get_json() /usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:607: in get_json
return self.on_json_loading_failed(None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def on_json_loading_failed(self, e: ValueError | None) -> t.Any:
"""Called if :meth:`get_json` fails and isn't silenced.
If this method returns a value, it is used as the return value
for :meth:`get_json`. The default implementation raises
:exc:`~werkzeug.exceptions.BadRequest`.
:param e: If parsing failed, this is the exception. It will be
``None`` if the content type wasn't ``application/json``.
.. versionchanged:: 2.3
Raise a 415 error instead of 400.
"""
if e is not None:
raise BadRequest(f"Failed to decode JSON object: {e}")
raise UnsupportedMediaType("Did not attempt to load JSON data because the request"
" Content-Type was not 'application/json'."
)
E werkzeug.exceptions.UnsupportedMediaType: 415 Unsupported Media Type: Did not attempt to load JSON data because the request Content-Type was not 'application/json'.
/usr/lib/python3/dist-packages/werkzeug/wrappers/request.py:650: UnsupportedMediaType
tag -1 pendingBug #1061028 [src:flask-restful] flask-restful: FTBFS: intersphinx inventory 'six/objects.inv' not fetchable due to <class 'FileNotFoundError'>: [Errno 2] No such file or directory: '/<<PKGBUILDDIR>>/docs/six/objects.inv'
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 297 |
Nodes: | 16 (2 / 14) |
Uptime: | 03:39:26 |
Calls: | 6,666 |
Files: | 12,213 |
Messages: | 5,335,790 |