Commit 4f95a52f authored by Ezio Melotti's avatar Ezio Melotti

#9233: skip _json-specific tests when _json is not available.

parent a8b0f9ad
import sys
import decimal
from unittest import TestCase
from unittest import TestCase, skipUnless
import json
import json.decoder
try:
import _json
except ImportError:
_json = None
class TestScanString(TestCase):
def test_py_scanstring(self):
self._test_scanstring(json.decoder.py_scanstring)
@skipUnless(_json, 'test requires the _json module')
def test_c_scanstring(self):
if json.decoder.c_scanstring is not None:
self._test_scanstring(json.decoder.c_scanstring)
......
import decimal
from unittest import TestCase
from unittest import TestCase, skipUnless
from json import decoder, encoder, scanner
try:
import _json
except ImportError:
_json = None
@skipUnless(_json, 'test requires the _json module')
class TestSpeedups(TestCase):
def test_scanstring(self):
self.assertEqual(decoder.scanstring.__module__, "_json")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment