Пример #1
0
def test_py2js_context_attribute_string():
    class Test:
        def __init__(self):
            self._id = 'test'

        def bind():
            getElementByUuid(self._id)

    self = Test()
    assert py2js.transpile(self.bind, self=self) == '''function bind() {
Пример #2
0
def test_py2js_context_attribute_deep():
    class Test_A:
        test = 'test'

    class Test:
        def __init__(self):
            self.x = Test_A()

        def log():
            # should write "console.log('test')"
            print(self.x.test)

    self = Test()
    assert py2js.transpile(self.log, self=self) == '''function log() {