diff --git a/test/js2tests/__init__.py b/test/js2tests/__init__.py index 30d55e92a..ecca434de 100644 --- a/test/js2tests/__init__.py +++ b/test/js2tests/__init__.py @@ -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(): diff --git a/test/js2tests/array_access.py b/test/js2tests/array_access.py index 72d089c15..3c933c916 100644 --- a/test/js2tests/array_access.py +++ b/test/js2tests/array_access.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS diff --git a/test/js2tests/assignments.py b/test/js2tests/assignments.py index 1705f9e02..13783425a 100644 --- a/test/js2tests/assignments.py +++ b/test/js2tests/assignments.py @@ -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 diff --git a/test/js2tests/basic.py b/test/js2tests/basic.py index c6790109b..97baf352b 100644 --- a/test/js2tests/basic.py +++ b/test/js2tests/basic.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token tests = [ diff --git a/test/js2tests/branch.py b/test/js2tests/branch.py index 6398f7d89..effa52740 100644 --- a/test/js2tests/branch.py +++ b/test/js2tests/branch.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token from youtube_dl.jsinterp2.tstream import _RELATIONS diff --git a/test/js2tests/calc.py b/test/js2tests/calc.py index f987973eb..2289002d2 100644 --- a/test/js2tests/calc.py +++ b/test/js2tests/calc.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token from youtube_dl.jsinterp2.tstream import _OPERATORS diff --git a/test/js2tests/call.py b/test/js2tests/call.py index 181c46fca..20078626b 100644 --- a/test/js2tests/call.py +++ b/test/js2tests/call.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token from youtube_dl.jsinterp2.tstream import _OPERATORS diff --git a/test/js2tests/comments.py b/test/js2tests/comments.py index 729e769ac..9c81638ad 100644 --- a/test/js2tests/comments.py +++ b/test/js2tests/comments.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token from youtube_dl.jsinterp2.tstream import _OPERATORS diff --git a/test/js2tests/debug.py b/test/js2tests/debug.py index aa81f8fd9..c2697db45 100644 --- a/test/js2tests/debug.py +++ b/test/js2tests/debug.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token skip = {'interpret': 'Interpreting debugger statement not yet implemented', diff --git a/test/js2tests/do_loop.py b/test/js2tests/do_loop.py index 04d7e0d01..dadf6b393 100644 --- a/test/js2tests/do_loop.py +++ b/test/js2tests/do_loop.py @@ -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 diff --git a/test/js2tests/empty_return.py b/test/js2tests/empty_return.py index 643c38e66..14c84cbe9 100644 --- a/test/js2tests/empty_return.py +++ b/test/js2tests/empty_return.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token tests = [ diff --git a/test/js2tests/for_empty.py b/test/js2tests/for_empty.py index ba90184fa..704e99592 100644 --- a/test/js2tests/for_empty.py +++ b/test/js2tests/for_empty.py @@ -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 diff --git a/test/js2tests/for_in.py b/test/js2tests/for_in.py index b5c111a0e..2a99e470c 100644 --- a/test/js2tests/for_in.py +++ b/test/js2tests/for_in.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS diff --git a/test/js2tests/for_loop.py b/test/js2tests/for_loop.py index 60cb03600..99b64148a 100644 --- a/test/js2tests/for_loop.py +++ b/test/js2tests/for_loop.py @@ -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 diff --git a/test/js2tests/func_expr.py b/test/js2tests/func_expr.py index 68e6fa6eb..d88d8e823 100644 --- a/test/js2tests/func_expr.py +++ b/test/js2tests/func_expr.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS diff --git a/test/js2tests/getfield.py b/test/js2tests/getfield.py index 3b63ce415..86fb79699 100644 --- a/test/js2tests/getfield.py +++ b/test/js2tests/getfield.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token tests = [ diff --git a/test/js2tests/label.py b/test/js2tests/label.py index 441abbba1..011ec9ed6 100644 --- a/test/js2tests/label.py +++ b/test/js2tests/label.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token skip = {'interpret': 'Interpreting label not yet implemented', diff --git a/test/js2tests/morespace.py b/test/js2tests/morespace.py index 2a18235b8..850a27b73 100644 --- a/test/js2tests/morespace.py +++ b/test/js2tests/morespace.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token from youtube_dl.jsinterp2.tstream import _ASSIGN_OPERATORS diff --git a/test/js2tests/object_literal.py b/test/js2tests/object_literal.py index ce651eb32..b486591ef 100644 --- a/test/js2tests/object_literal.py +++ b/test/js2tests/object_literal.py @@ -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 diff --git a/test/js2tests/operators.py b/test/js2tests/operators.py index 757cef523..f54c8a5f5 100644 --- a/test/js2tests/operators.py +++ b/test/js2tests/operators.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token from youtube_dl.jsinterp2.tstream import _OPERATORS diff --git a/test/js2tests/parens.py b/test/js2tests/parens.py index fe433a09b..2f59f661c 100644 --- a/test/js2tests/parens.py +++ b/test/js2tests/parens.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token from youtube_dl.jsinterp2.tstream import _OPERATORS diff --git a/test/js2tests/precedence.py b/test/js2tests/precedence.py index 47a80fd28..094fc201c 100644 --- a/test/js2tests/precedence.py +++ b/test/js2tests/precedence.py @@ -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 diff --git a/test/js2tests/strange_chars.py b/test/js2tests/strange_chars.py index 3d3c9b1ad..1ad397782 100644 --- a/test/js2tests/strange_chars.py +++ b/test/js2tests/strange_chars.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token from youtube_dl.jsinterp2.tstream import _OPERATORS diff --git a/test/js2tests/switch.py b/test/js2tests/switch.py index 66fed25a9..7d38e5261 100644 --- a/test/js2tests/switch.py +++ b/test/js2tests/switch.py @@ -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 diff --git a/test/js2tests/try_statement.py b/test/js2tests/try_statement.py index 8e93ee398..b3596a7c6 100644 --- a/test/js2tests/try_statement.py +++ b/test/js2tests/try_statement.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token skip = {'interpret': 'Interpreting try statement not yet implemented', diff --git a/test/js2tests/unary.py b/test/js2tests/unary.py index 4d7c16774..a5d4ce3eb 100644 --- a/test/js2tests/unary.py +++ b/test/js2tests/unary.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals skip = {'parse': True} diff --git a/test/js2tests/unshift.py b/test/js2tests/unshift.py index 02ab96874..13f4f07fc 100644 --- a/test/js2tests/unshift.py +++ b/test/js2tests/unshift.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals tests = [ { diff --git a/test/js2tests/while_loop.py b/test/js2tests/while_loop.py index 39078a11b..0ce17a18e 100644 --- a/test/js2tests/while_loop.py +++ b/test/js2tests/while_loop.py @@ -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 diff --git a/test/js2tests/with_statement.py b/test/js2tests/with_statement.py index 84ed25069..5336b4a76 100644 --- a/test/js2tests/with_statement.py +++ b/test/js2tests/with_statement.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from youtube_dl.jsinterp2.jsgrammar import Token skip = {'interpret': 'Interpreting with statement not yet implemented', diff --git a/test/test_jsinterp.py b/test/test_jsinterp.py index 81a401c53..078075065 100644 --- a/test/test_jsinterp.py +++ b/test/test_jsinterp.py @@ -1,8 +1,8 @@ #!/usr/bin/env python -""" -see: `js2tests` -""" +# """ +# see: `js2tests` +# """ from __future__ import unicode_literals diff --git a/test/test_jsinterp_parse.py b/test/test_jsinterp_parse.py index d87537b2c..4fee2cbc6 100644 --- a/test/test_jsinterp_parse.py +++ b/test/test_jsinterp_parse.py @@ -1,8 +1,8 @@ #!/usr/bin/env python -""" -see: `js2tests` -""" +# """ +# see: `js2tests` +# """ from __future__ import unicode_literals diff --git a/youtube_dl/jsinterp2/__init__.py b/youtube_dl/jsinterp2/__init__.py index 61096d6aa..d7500a3f3 100644 --- a/youtube_dl/jsinterp2/__init__.py +++ b/youtube_dl/jsinterp2/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from .jsinterp import JSInterpreter __all__ = ['JSInterpreter']