[jsinterp] Unicode docstring hack
This commit is contained in:
parent
b9061d69e2
commit
2ce996c688
@ -1,53 +1,54 @@
|
||||
# TODO use json instead of py
|
||||
# TODO create devscript to generate ASTs (using e.g. acorn)
|
||||
# """
|
||||
# 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': []
|
||||
# }
|
||||
# ]
|
||||
# """
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
__doc__ = """
|
||||
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': []
|
||||
}
|
||||
]
|
||||
"""
|
||||
|
||||
|
||||
def gettestcases():
|
||||
import os
|
||||
|
@ -1,9 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# """
|
||||
# see: `js2tests`
|
||||
# """
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# Allow direct execution
|
||||
@ -20,6 +16,9 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
from youtube_dl.jsinterp import JSInterpreter
|
||||
from .js2tests import gettestcases
|
||||
|
||||
__doc__ = """see: `js2tests`"""
|
||||
|
||||
|
||||
defs = gettestcases()
|
||||
# set level to logging.DEBUG to see messages about missing assertions
|
||||
logging.basicConfig(stream=sys.stderr, level=logging.WARNING)
|
||||
|
@ -1,9 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# """
|
||||
# see: `js2tests`
|
||||
# """
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# Allow direct execution
|
||||
@ -20,6 +16,9 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
from youtube_dl.jsinterp2 import JSInterpreter
|
||||
from .js2tests import gettestcases
|
||||
|
||||
__doc__ = """see: `js2tests`"""
|
||||
|
||||
|
||||
defs = gettestcases()
|
||||
# set level to logging.DEBUG to see messages about missing assertions
|
||||
logging.basicConfig(stream=sys.stderr, level=logging.WARNING)
|
||||
|
@ -1,9 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# """
|
||||
# see: `js2tests`
|
||||
# """
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# Allow direct execution
|
||||
@ -34,6 +30,9 @@ def traverse(node, tree_types=(list, tuple)):
|
||||
return node
|
||||
|
||||
|
||||
__doc__ = """see: `js2tests`"""
|
||||
|
||||
|
||||
defs = gettestcases()
|
||||
# set level to logging.DEBUG to see messages about not set ASTs
|
||||
logging.basicConfig(stream=sys.stderr, level=logging.WARNING)
|
||||
|
Loading…
x
Reference in New Issue
Block a user