Python simplejson.decoder() Examples

The following are 16 code examples of simplejson.decoder(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module simplejson , or try the search function .
Example #1
Source File: __init__.py    From Tautulli with GNU General Public License v3.0 6 votes vote down vote up
def additional_tests(suite=None):
    import simplejson
    import simplejson.encoder
    import simplejson.decoder
    if suite is None:
        suite = unittest.TestSuite()
    try:
        import doctest
    except ImportError:
        if sys.version_info < (2, 7):
            # doctests in 2.6 depends on cStringIO
            return suite
        raise
    for mod in (simplejson, simplejson.encoder, simplejson.decoder):
        suite.addTest(doctest.DocTestSuite(mod))
    suite.addTest(doctest.DocFileSuite('../../index.rst'))
    return suite 
Example #2
Source File: __init__.py    From qgis-cartodb with GNU General Public License v2.0 5 votes vote down vote up
def additional_tests(suite=None):
    import simplejson
    import simplejson.encoder
    import simplejson.decoder
    if suite is None:
        suite = unittest.TestSuite()
    for mod in (simplejson, simplejson.encoder, simplejson.decoder):
        suite.addTest(doctest.DocTestSuite(mod))
    suite.addTest(doctest.DocFileSuite('../../index.rst'))
    return suite 
Example #3
Source File: test_scanstring.py    From qgis-cartodb with GNU General Public License v2.0 5 votes vote down vote up
def test_py_scanstring(self):
        self._test_scanstring(simplejson.decoder.py_scanstring) 
Example #4
Source File: test_scanstring.py    From qgis-cartodb with GNU General Public License v2.0 5 votes vote down vote up
def test_c_scanstring(self):
        if not simplejson.decoder.c_scanstring:
            return
        self._test_scanstring(simplejson.decoder.c_scanstring) 
Example #5
Source File: test_scanstring.py    From qgis-cartodb with GNU General Public License v2.0 5 votes vote down vote up
def test_issue3623(self):
        self.assertRaises(ValueError, json.decoder.scanstring, "xxx", 1,
                          "xxx")
        self.assertRaises(UnicodeDecodeError,
                          json.encoder.encode_basestring_ascii, b("xx\xff")) 
Example #6
Source File: test_scanstring.py    From qgis-cartodb with GNU General Public License v2.0 5 votes vote down vote up
def test_overflow(self):
        # Python 2.5 does not have maxsize, Python 3 does not have maxint
        maxsize = getattr(sys, 'maxsize', getattr(sys, 'maxint', None))
        assert maxsize is not None
        self.assertRaises(OverflowError, json.decoder.scanstring, "xxx",
                          maxsize + 1) 
Example #7
Source File: __init__.py    From mishkal with GNU General Public License v3.0 5 votes vote down vote up
def additional_tests(suite=None):
    import simplejson
    import simplejson.encoder
    import simplejson.decoder
    if suite is None:
        suite = unittest.TestSuite()
    for mod in (simplejson, simplejson.encoder, simplejson.decoder):
        suite.addTest(doctest.DocTestSuite(mod))
    suite.addTest(doctest.DocFileSuite('../../index.rst'))
    return suite 
Example #8
Source File: __init__.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def additional_tests(suite=None):
    import simplejson
    import simplejson.encoder
    import simplejson.decoder
    if suite is None:
        suite = unittest.TestSuite()
    for mod in (simplejson, simplejson.encoder, simplejson.decoder):
        suite.addTest(doctest.DocTestSuite(mod))
    suite.addTest(doctest.DocFileSuite('../../index.rst'))
    return suite 
Example #9
Source File: test_scanstring.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def test_py_scanstring(self):
        self._test_scanstring(simplejson.decoder.py_scanstring) 
Example #10
Source File: test_scanstring.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def test_c_scanstring(self):
        if not simplejson.decoder.c_scanstring:
            return
        self._test_scanstring(simplejson.decoder.c_scanstring) 
Example #11
Source File: test_scanstring.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def test_issue3623(self):
        self.assertRaises(ValueError, json.decoder.scanstring, "xxx", 1,
                          "xxx")
        self.assertRaises(UnicodeDecodeError,
                          json.encoder.encode_basestring_ascii, b("xx\xff")) 
Example #12
Source File: test_scanstring.py    From syntheticmass with Apache License 2.0 5 votes vote down vote up
def test_overflow(self):
        # Python 2.5 does not have maxsize, Python 3 does not have maxint
        maxsize = getattr(sys, 'maxsize', getattr(sys, 'maxint', None))
        assert maxsize is not None
        self.assertRaises(OverflowError, json.decoder.scanstring, "xxx",
                          maxsize + 1) 
Example #13
Source File: test_scanstring.py    From Tautulli with GNU General Public License v3.0 5 votes vote down vote up
def test_py_scanstring(self):
        self._test_scanstring(simplejson.decoder.py_scanstring) 
Example #14
Source File: test_scanstring.py    From Tautulli with GNU General Public License v3.0 5 votes vote down vote up
def test_c_scanstring(self):
        if not simplejson.decoder.c_scanstring:
            return
        self._test_scanstring(simplejson.decoder.c_scanstring)

        self.assertTrue(isinstance(simplejson.decoder.c_scanstring('""', 0)[0], str)) 
Example #15
Source File: test_scanstring.py    From Tautulli with GNU General Public License v3.0 5 votes vote down vote up
def test_issue3623(self):
        self.assertRaises(ValueError, json.decoder.scanstring, "xxx", 1,
                          "xxx")
        self.assertRaises(UnicodeDecodeError,
                          json.encoder.encode_basestring_ascii, b("xx\xff")) 
Example #16
Source File: test_scanstring.py    From Tautulli with GNU General Public License v3.0 5 votes vote down vote up
def test_overflow(self):
        # Python 2.5 does not have maxsize, Python 3 does not have maxint
        maxsize = getattr(sys, 'maxsize', getattr(sys, 'maxint', None))
        assert maxsize is not None
        self.assertRaises(OverflowError, json.decoder.scanstring, "xxx",
                          maxsize + 1)