Skip to content

Commit b510ade

Browse files
committed
added a set of reference translations from python to js
1 parent a78b680 commit b510ade

26 files changed

Lines changed: 135 additions & 0 deletions

tests/python-to-js/JS_assign.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a = JS('value')

tests/python-to-js/JS_assign.py.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a = value;

tests/python-to-js/JS_expr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
JS('testing something improbable')

tests/python-to-js/JS_expr.py.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testing something improbable;

tests/python-to-js/comparaisons.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
print True == 1
2+
print False != 1
3+
print None is None
4+
print 1 < 2
5+
print 2 > 1
6+
print 1 >= 1
7+
print 2 <= 2
8+
print not True
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
console.log(true == 1);
2+
console.log(false != 1);
3+
console.log(undefined === undefined);
4+
console.log(1 < 2);
5+
console.log(2 > 1);
6+
console.log(1 >= 1);
7+
console.log(2 <= 2);
8+
console.log(!true);

tests/python-to-js/function.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def function(a, b, c, d):
2+
return a + b + c + d
3+
print function(1, 2, 3, 4)

tests/python-to-js/function.py.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var function = function(args, kwargs) {
2+
var signature = {"kwargs": {}, "args": create_array("a", "b", "c", "d")};
3+
var arguments = get_arguments(signature, args, kwargs);
4+
var d = arguments["d"];
5+
var c = arguments["c"];
6+
var b = arguments["b"];
7+
var a = arguments["a"];
8+
return a + b + c + d;
9+
}
10+
11+
console.log(get_attribute(function, "__call__")(create_array(1, 2, 3, 4), {}));

tests/python-to-js/if.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
a = 1
2+
if a == 1:
3+
print True

tests/python-to-js/if.py.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
a = 1;
2+
if(a == 1) {
3+
console.log(true);
4+
}
5+

0 commit comments

Comments
 (0)