[jsinterp] Using unicode literals

This commit is contained in:
sulyi 2018-05-31 06:37:27 +02:00
parent 1126698b4c
commit e44a25227e
32 changed files with 108 additions and 50 deletions

View File

@ -1,48 +1,50 @@
"""
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.
Each subtest initializes an instance of the tested class and runs one or more assertion.
# """
# 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.
# 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``.
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': []
}
]
"""
from __future__ import unicode_literals
def gettestcases():

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _OPERATORS, _ASSIGN_OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
tests = [

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _RELATIONS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
skip = {'interpret': 'Interpreting debugger statement not yet implemented',

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
tests = [

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
tests = [

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
skip = {'interpret': 'Interpreting label not yet implemented',

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
skip = {'interpret': 'Interpreting try statement not yet implemented',

View File

@ -1,3 +1,4 @@
from __future__ import unicode_literals
skip = {'parse': True}

View File

@ -1,3 +1,4 @@
from __future__ import unicode_literals
tests = [
{

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS, _UNARY_OPERATORS, _RELATIONS

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from youtube_dl.jsinterp2.jsgrammar import Token
skip = {'interpret': 'Interpreting with statement not yet implemented',

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python
"""
see: `js2tests`
"""
# """
# see: `js2tests`
# """
from __future__ import unicode_literals

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python
"""
see: `js2tests`
"""
# """
# see: `js2tests`
# """
from __future__ import unicode_literals

View File

@ -1,3 +1,5 @@
from __future__ import unicode_literals
from .jsinterp import JSInterpreter
__all__ = ['JSInterpreter']