summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanaasagi <ambiguous404@gmail.com>2019-01-05 13:33:17 +0900
committerMarcel Hellkamp <marc@gsites.de>2019-01-31 14:24:17 +0100
commita454029f6e8a087e5cb570eb6ee36c2087d26e4d (patch)
treef6ebcd4a694d70c59d006a250b51510055058254
parent0607494b142d2d3276c3aa9559d5e8c0674fe95f (diff)
downloadbottle-a454029f6e8a087e5cb570eb6ee36c2087d26e4d.tar.gz
current bottle only support 2.7 and above, json is stdlib
-rwxr-xr-xtest/test_outputfilter.py32
1 files changed, 12 insertions, 20 deletions
diff --git a/test/test_outputfilter.py b/test/test_outputfilter.py
index 17c7890..219bd15 100755
--- a/test/test_outputfilter.py
+++ b/test/test_outputfilter.py
@@ -77,11 +77,9 @@ class TestOutputFilter(ServerTestBase):
def test_json(self):
self.app.route('/')(lambda: {'a': 1})
- try:
- self.assertBody(bottle.json_dumps({'a': 1}))
- self.assertHeader('Content-Type','application/json')
- except ImportError:
- warn("Skipping JSON tests.")
+
+ self.assertBody(bottle.json_dumps({'a': 1}))
+ self.assertHeader('Content-Type','application/json')
@unittest.skipIf(USING_UJSON, 'ujson do not throw exception in serialize')
def test_json_serialization_error(self):
@@ -90,29 +88,23 @@ class TestOutputFilter(ServerTestBase):
content-type application/json
"""
self.app.route('/')(lambda: {'a': set()})
- try:
- self.assertStatus(500)
- self.assertHeader('Content-Type','text/html; charset=UTF-8')
- except ImportError:
- warn("Skipping JSON tests.")
+
+ self.assertStatus(500)
+ self.assertHeader('Content-Type','text/html; charset=UTF-8')
def test_json_HTTPResponse(self):
self.app.route('/')(lambda: bottle.HTTPResponse({'a': 1}, 500))
- try:
- self.assertBody(bottle.json_dumps({'a': 1}))
- self.assertHeader('Content-Type','application/json')
- except ImportError:
- warn("Skipping JSON tests.")
+
+ self.assertBody(bottle.json_dumps({'a': 1}))
+ self.assertHeader('Content-Type','application/json')
def test_json_HTTPError(self):
self.app.error(400)(lambda e: e.body)
self.app.route('/')(lambda: bottle.HTTPError(400, {'a': 1}))
- try:
- self.assertBody(bottle.json_dumps({'a': 1}))
- self.assertHeader('Content-Type','application/json')
- except ImportError:
- warn("Skipping JSON tests.")
+
+ self.assertBody(bottle.json_dumps({'a': 1}))
+ self.assertHeader('Content-Type','application/json')
def test_generator_callback(self):
@self.app.route('/')