예제 #1
0
def test_serialize_property_access_with_subscript_notation():
    assert_equal("x[y]", _dumps(js.property_access(js.ref("x"), js.ref("y"))))
예제 #2
0
def test_parens_are_not_used_if_high_precedence_operation_is_inside_low_precedence_operation():
    assert_equal("x.y || z", _dumps(js.or_(js.property_access(js.ref("x"), "y"), js.ref("z"))))
예제 #3
0
def test_serialize_property_access_with_dot_notation():
    assert_equal("x.y", _dumps(js.property_access(js.ref("x"), "y")))
예제 #4
0
def test_transform_assignment_to_attribute_sets_property_directly():
    _assert_transform(
        cc.assign(cc.attr(cc.ref("x"), "y"), cc.ref("z")),
        js.expression_statement(js.assign(js.property_access(js.ref("x"), "y"), js.ref("z"))),
    )