[jsinterp] Using unicode literals
This commit is contained in:
parent
1126698b4c
commit
e44a25227e
@ -1,48 +1,50 @@
|
|||||||
"""
|
# """
|
||||||
This package contains templates for `test_jsinterp` and `test_interp_parse` to create test methods.
|
# This package contains templates for `test_jsinterp` and `test_interp_parse` to create test methods.
|
||||||
These modules will create a test method for each module in this package. A test method consist of one or more subtest.
|
# These modules will create a test method for each module in this package. A test method consist of one or more subtest.
|
||||||
Each subtest initializes an instance of the tested class and runs one or more assertion.
|
# Each subtest initializes an instance of the tested class and runs one or more assertion.
|
||||||
|
#
|
||||||
|
# Any module should have a `list` of `dict` named ``tests`` and optionally a `dict` named ``skip``.
|
||||||
|
#
|
||||||
|
# Each `dict` in ``tests`` may have the following keys:
|
||||||
|
#
|
||||||
|
# code: If missing subtest is skipped, Otherwise it's value is used as code to initialize the tested class.
|
||||||
|
# globals: Optional. Used only by `test_jsinterp`. If set used as argument `variables` initializing `JSInterperter`.
|
||||||
|
# asserts: Used only by `test_jsinterp`. If this is missing subtest is skipped, Should be a list of `dict`, each used
|
||||||
|
# as an assertion for the initialized `JSInterpreter`. Each `dict` may have the following keys:
|
||||||
|
# value: If missing assertion is skipped. Otherwise it's value is used as expected value in
|
||||||
|
# an `assertEqual` call.
|
||||||
|
# call: Optional. If set used as arguments of a `call_function` call of the initialized `JSInterpreter`
|
||||||
|
# and the actual value of the created `assertEqual` call will be the return value of it.
|
||||||
|
# Otherwise the actual value will be the return value of the `run` call.
|
||||||
|
# ast: Used only by `test_interp_parse`. If missing subtest is skipped, Otherwise it's value is used as
|
||||||
|
# expected value in an `assertEqual` call. The actual value will be the return value of the `parse` call
|
||||||
|
# converted to `list`. Both on expected anc actual value `traverse` is called first to flatten and handle `zip`
|
||||||
|
# objects.
|
||||||
|
#
|
||||||
|
# In the `dict` named ``skip`` is optional and may have the following keys:
|
||||||
|
# interpret
|
||||||
|
# parse
|
||||||
|
# Both used as the argument of `skipTest` decorator of the created test method in `test_jsinterp`
|
||||||
|
# and `test_jsinterp_parse` respectably. Unless they're value is `True`, that case the test method is skipped entirely,
|
||||||
|
# or `False`, which is the default value.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# This is not a functional template, rather a skeleton:
|
||||||
|
#
|
||||||
|
# skip = {'interpret': 'Test not yet implemented',
|
||||||
|
# 'parse': 'Test not yet implemented'}
|
||||||
|
#
|
||||||
|
# tests = [
|
||||||
|
# {
|
||||||
|
# 'code': '',
|
||||||
|
# 'globals': {},
|
||||||
|
# 'asserts': [{'value': 0, 'call': ('f',)}],
|
||||||
|
# 'ast': []
|
||||||
|
# }
|
||||||
|
# ]
|
||||||
|
# """
|
||||||
|
|
||||||
Any module should have a `list` of `dict` named ``tests`` and optionally a `dict` named ``skip``.
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
Each `dict` in ``tests`` may have the following keys:
|
|
||||||
|
|
||||||
code: If missing subtest is skipped, Otherwise it's value is used as code to initialize the tested class.
|
|
||||||
globals: Optional. Used only by `test_jsinterp`. If set used as argument `variables` initializing `JSInterperter`.
|
|
||||||
asserts: Used only by `test_jsinterp`. If this is missing subtest is skipped, Should be a list of `dict`, each used
|
|
||||||
as an assertion for the initialized `JSInterpreter`. Each `dict` may have the following keys:
|
|
||||||
value: If missing assertion is skipped. Otherwise it's value is used as expected value in
|
|
||||||
an `assertEqual` call.
|
|
||||||
call: Optional. If set used as arguments of a `call_function` call of the initialized `JSInterpreter`
|
|
||||||
and the actual value of the created `assertEqual` call will be the return value of it.
|
|
||||||
Otherwise the actual value will be the return value of the `run` call.
|
|
||||||
ast: Used only by `test_interp_parse`. If missing subtest is skipped, Otherwise it's value is used as
|
|
||||||
expected value in an `assertEqual` call. The actual value will be the return value of the `parse` call
|
|
||||||
converted to `list`. Both on expected anc actual value `traverse` is called first to flatten and handle `zip`
|
|
||||||
objects.
|
|
||||||
|
|
||||||
In the `dict` named ``skip`` is optional and may have the following keys:
|
|
||||||
interpret
|
|
||||||
parse
|
|
||||||
Both used as the argument of `skipTest` decorator of the created test method in `test_jsinterp`
|
|
||||||
and `test_jsinterp_parse` respectably. Unless they're value is `True`, that case the test method is skipped entirely,
|
|
||||||
or `False`, which is the default value.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
This is not a functional template, rather a skeleton:
|
|
||||||
|
|
||||||
skip = {'interpret': 'Test not yet implemented',
|
|
||||||
'parse': 'Test not yet implemented'}
|
|
||||||
|
|
||||||
tests = [
|
|
||||||
{
|
|
||||||
'code': '',
|
|
||||||
'globals': {},
|
|
||||||
'asserts': [{'value': 0, 'call': ('f',)}],
|
|
||||||
'ast': []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def gettestcases():
|
def gettestcases():
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS
|
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _OPERATORS, _ASSIGN_OPERATORS
|
from youtube_dl.jsinterp2.tstream import _OPERATORS, _ASSIGN_OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _RELATIONS
|
from youtube_dl.jsinterp2.tstream import _RELATIONS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _OPERATORS
|
from youtube_dl.jsinterp2.tstream import _OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _OPERATORS
|
from youtube_dl.jsinterp2.tstream import _OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _OPERATORS
|
from youtube_dl.jsinterp2.tstream import _OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
|
|
||||||
skip = {'interpret': 'Interpreting debugger statement not yet implemented',
|
skip = {'interpret': 'Interpreting debugger statement not yet implemented',
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS
|
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS
|
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS
|
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS
|
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS
|
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
|
|
||||||
skip = {'interpret': 'Interpreting label not yet implemented',
|
skip = {'interpret': 'Interpreting label not yet implemented',
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS
|
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _OPERATORS
|
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _OPERATORS
|
from youtube_dl.jsinterp2.tstream import _OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _OPERATORS
|
from youtube_dl.jsinterp2.tstream import _OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _OPERATORS
|
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _OPERATORS
|
from youtube_dl.jsinterp2.tstream import _OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS
|
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
|
|
||||||
skip = {'interpret': 'Interpreting try statement not yet implemented',
|
skip = {'interpret': 'Interpreting try statement not yet implemented',
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
skip = {'parse': True}
|
skip = {'parse': True}
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS
|
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from youtube_dl.jsinterp2.jsgrammar import Token
|
from youtube_dl.jsinterp2.jsgrammar import Token
|
||||||
|
|
||||||
skip = {'interpret': 'Interpreting with statement not yet implemented',
|
skip = {'interpret': 'Interpreting with statement not yet implemented',
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
"""
|
# """
|
||||||
see: `js2tests`
|
# see: `js2tests`
|
||||||
"""
|
# """
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
"""
|
# """
|
||||||
see: `js2tests`
|
# see: `js2tests`
|
||||||
"""
|
# """
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .jsinterp import JSInterpreter
|
from .jsinterp import JSInterpreter
|
||||||
|
|
||||||
__all__ = ['JSInterpreter']
|
__all__ = ['JSInterpreter']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user