sphinx/tests/test_util_jsdump.py
Silvio Tomatis 45473b3334 Make javascript search work in more contexts
The meaning of `\w` changed from python 2 to python 3.

> $ python3.5 -c "import re; print(re.compile(r'[a-zA-Z]\w*$').match(u'a\xe8'));"
> <_sre.SRE_Match object; span=(0, 2), match='aè'>

> python -c "import re; print(re.compile(r'[a-zA-Z]\w*$').match(u'a\xe8'));"
> None

but the definition of what's an acceptable javascript identifier should not vary from case to case.
2016-07-08 15:27:48 +02:00

10 lines
221 B
Python

# -*- coding: utf-8 -*-
def test_jsdump():
from sphinx.util.jsdump import dumps
assert dumps({'1a': 1}) == '{"1a":1}'
assert dumps({'a1': 1}) == '{a1:1}'
assert dumps({u'a\xe8': 1}) == '{"a\\u00e8":1}'