File: test_speedups.py

package info (click to toggle)
python-pyutil 3.3.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 884 kB
  • sloc: python: 7,198; makefile: 6
file content (20 lines) | stat: -rw-r--r-- 912 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# -*- coding: utf-8; fill-column: 77 -*-
# -*- indent-tabs-mode: nil -*-
from twisted.trial.unittest import SkipTest, TestCase

from pyutil.jsonutil import decoder
from pyutil.jsonutil import encoder

class TestSpeedups(TestCase):
    def test_scanstring(self):
        if not encoder.c_encode_basestring_ascii:
            raise SkipTest("no C extension speedups available to test")
        self.assertEqual(decoder.scanstring.__module__, "simplejson._speedups")
        self.assertTrue(decoder.scanstring is decoder.c_scanstring)

    def test_encode_basestring_ascii(self):
        if not encoder.c_encode_basestring_ascii:
            raise SkipTest("no C extension speedups available to test")
        self.assertEqual(encoder.encode_basestring_ascii.__module__, "simplejson._speedups")
        self.assertTrue(encoder.encode_basestring_ascii is
                          encoder.c_encode_basestring_ascii)