diff --git a/src/libasr/codegen/asr_to_python.cpp b/src/libasr/codegen/asr_to_python.cpp index 69f7a0bf4d..fa9a06adc4 100644 --- a/src/libasr/codegen/asr_to_python.cpp +++ b/src/libasr/codegen/asr_to_python.cpp @@ -165,7 +165,6 @@ class ASRToLpythonVisitor : public ASR::BaseVisitor if (is_a(*item.second)) { visit_symbol(*item.second); r += s; - r += "\n"; } } @@ -173,7 +172,6 @@ class ASRToLpythonVisitor : public ASR::BaseVisitor if (is_a(*item.second)) { visit_symbol(*item.second); r += s; - r += "\n"; } } @@ -240,8 +238,6 @@ class ASRToLpythonVisitor : public ASR::BaseVisitor r += s; } } - - r += "\n"; s = r; } @@ -347,7 +343,6 @@ class ASRToLpythonVisitor : public ASR::BaseVisitor visit_stmt(*x.m_orelse[i]); r += s; dec_indent(); - r += "\n"; } } s = r; diff --git a/tests/reference/python-assert1-192ca6c.json b/tests/reference/python-assert1-192ca6c.json index ed9457882f..1db5a55ee7 100644 --- a/tests/reference/python-assert1-192ca6c.json +++ b/tests/reference/python-assert1-192ca6c.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "python-assert1-192ca6c.stdout", - "stdout_hash": "2120f9dd9a8d41e4d67cced7ceb14c4ded9d56335058f66b24cfe12e", + "stdout_hash": "0de7de97bd936f6a66e73ba9789e50ed968b66edce04acfcc168c6db", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/python-assert1-192ca6c.stdout b/tests/reference/python-assert1-192ca6c.stdout index 77016e73f3..88a510476c 100644 --- a/tests/reference/python-assert1-192ca6c.stdout +++ b/tests/reference/python-assert1-192ca6c.stdout @@ -3,5 +3,3 @@ def test_assert(): a = 5 assert (a) == (5), "a is not 5" assert (a) != (10) - - diff --git a/tests/reference/python-assign1-f87bafa.json b/tests/reference/python-assign1-f87bafa.json index f4ce6903f8..ac0ac5afda 100644 --- a/tests/reference/python-assign1-f87bafa.json +++ b/tests/reference/python-assign1-f87bafa.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "python-assign1-f87bafa.stdout", - "stdout_hash": "6fa5f5e1492cac718631d3c05d27ab2ddda15dd2e56cc37a1ce188b9", + "stdout_hash": "bd60a7791394a67503473530adb0369f2f12407e0108423397f3e4e4", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/python-assign1-f87bafa.stdout b/tests/reference/python-assign1-f87bafa.stdout index caa7aaf2a6..e083f35a45 100644 --- a/tests/reference/python-assign1-f87bafa.stdout +++ b/tests/reference/python-assign1-f87bafa.stdout @@ -11,5 +11,3 @@ def test_augassign(): r = r / s a = "" a = a + "test" - - diff --git a/tests/reference/python-expr11-e6681c8.json b/tests/reference/python-expr11-e6681c8.json index 067b2c4518..9f40e4dc6d 100644 --- a/tests/reference/python-expr11-e6681c8.json +++ b/tests/reference/python-expr11-e6681c8.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "python-expr11-e6681c8.stdout", - "stdout_hash": "6ae1afc8767434e703cfd38bbdd22275c73effa90a5e86c5c09bab5b", + "stdout_hash": "425a18a0b44e596e166ce94fad47878623b4dd9b4d534419b7f18683", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/python-expr11-e6681c8.stdout b/tests/reference/python-expr11-e6681c8.stdout index da61c57b5a..a108676193 100644 --- a/tests/reference/python-expr11-e6681c8.stdout +++ b/tests/reference/python-expr11-e6681c8.stdout @@ -6,5 +6,3 @@ def test_StrOp_repeat(): s = "bb" * 4 s = "bb" * -(40) s = "a" * 3 * 3 - - diff --git a/tests/reference/python-expr14-2e6ab03.json b/tests/reference/python-expr14-2e6ab03.json new file mode 100644 index 0000000000..57dfc1ce5e --- /dev/null +++ b/tests/reference/python-expr14-2e6ab03.json @@ -0,0 +1,13 @@ +{ + "basename": "python-expr14-2e6ab03", + "cmd": "lpython --no-color --show-python {infile}", + "infile": "tests/expr14.py", + "infile_hash": "d18abc152939c944f6a1e493754cea8b72f0d03d360ab4c9e75ad697", + "outfile": null, + "outfile_hash": null, + "stdout": "python-expr14-2e6ab03.stdout", + "stdout_hash": "52e647db794a391cb9ebd5978bb97de935a62e1b85d890232b1a878a", + "stderr": null, + "stderr_hash": null, + "returncode": 0 +} \ No newline at end of file diff --git a/tests/reference/python-expr14-2e6ab03.stdout b/tests/reference/python-expr14-2e6ab03.stdout new file mode 100644 index 0000000000..fcb9a3f182 --- /dev/null +++ b/tests/reference/python-expr14-2e6ab03.stdout @@ -0,0 +1,12 @@ +def test_boolean_comparison(): + b1: bool + b2: bool + b3: bool + b1 = True + b2 = True + b3 = False + b1 = (b1) > (b2) + b1 = (b1) == (b2) + b1 = (b2) != (b3) + b1 = (b2) >= (b3) + b1 = (b2) <= (b3) diff --git a/tests/reference/python-expr17-3b84714.json b/tests/reference/python-expr17-3b84714.json index 11933a5b96..5ad1fd4c8d 100644 --- a/tests/reference/python-expr17-3b84714.json +++ b/tests/reference/python-expr17-3b84714.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "python-expr17-3b84714.stdout", - "stdout_hash": "c5754f71e1cd9a019d7289d5ccee634a42d75ac775b0e115eea48f03", + "stdout_hash": "9daa5ee66df347ea965190959be6eee3c070b52b38b0c9b52de04e2d", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/python-expr17-3b84714.stdout b/tests/reference/python-expr17-3b84714.stdout index 48b07875e4..d0f78d5ffe 100644 --- a/tests/reference/python-expr17-3b84714.stdout +++ b/tests/reference/python-expr17-3b84714.stdout @@ -8,7 +8,3 @@ def if_check(): print("positive value") else: print("zero") - - - - diff --git a/tests/reference/python-expr2-6b69018.json b/tests/reference/python-expr2-6b69018.json index 784e5f3e6f..07c3053bc1 100644 --- a/tests/reference/python-expr2-6b69018.json +++ b/tests/reference/python-expr2-6b69018.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "python-expr2-6b69018.stdout", - "stdout_hash": "849450cb39ead48c1935431e54d989370ecece8c711f34e4ca38fd2b", + "stdout_hash": "b9e6fef7e82bbf96d66869ae6fd739c46c8d20e5bafabb48a6a15fce", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/python-expr2-6b69018.stdout b/tests/reference/python-expr2-6b69018.stdout index 45bd2f5ccc..523311bbaa 100644 --- a/tests/reference/python-expr2-6b69018.stdout +++ b/tests/reference/python-expr2-6b69018.stdout @@ -9,5 +9,3 @@ def test_boolOp(): a = a and b == b a = a and b != b a = b or b - - diff --git a/tests/reference/python-expr4-161a0ec.json b/tests/reference/python-expr4-161a0ec.json index 9823faecf8..abc691f0c0 100644 --- a/tests/reference/python-expr4-161a0ec.json +++ b/tests/reference/python-expr4-161a0ec.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "python-expr4-161a0ec.stdout", - "stdout_hash": "1378e1d01da96646ba0d45dbc6f5d30f7956e1c874c558df95a9f733", + "stdout_hash": "6dbfa328171f15601ab250ddecda5d36beb85a4922a60f583c932d4a", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/python-expr4-161a0ec.stdout b/tests/reference/python-expr4-161a0ec.stdout index a6a301dd99..81dfdff136 100644 --- a/tests/reference/python-expr4-161a0ec.stdout +++ b/tests/reference/python-expr4-161a0ec.stdout @@ -3,5 +3,4 @@ def test_del(): b: i32 a = 4 b = 20 - del a, b - + del a, b \ No newline at end of file diff --git a/tests/reference/python-expr5-dee0e5c.json b/tests/reference/python-expr5-dee0e5c.json index 5cf281a38d..1c3f9279d8 100644 --- a/tests/reference/python-expr5-dee0e5c.json +++ b/tests/reference/python-expr5-dee0e5c.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "python-expr5-dee0e5c.stdout", - "stdout_hash": "cef56dbae8b4efd362ea96bcbdc080667fd46930c1d7cfbca92bbe8e", + "stdout_hash": "e4b6285bbd4e701c75f2abdeb7c21dc8b489f5c5ef848074c5ce1e3b", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/python-expr5-dee0e5c.stdout b/tests/reference/python-expr5-dee0e5c.stdout index b63878db76..92fb4ec53b 100644 --- a/tests/reference/python-expr5-dee0e5c.stdout +++ b/tests/reference/python-expr5-dee0e5c.stdout @@ -3,5 +3,3 @@ def test_StrOp_concat(): s = "3" + "4" s = "a " + "test" s = "test" + "test" + "test" - - diff --git a/tests/reference/python-expr6-1a1d4fb.json b/tests/reference/python-expr6-1a1d4fb.json index f1eb23d77b..4637905e1c 100644 --- a/tests/reference/python-expr6-1a1d4fb.json +++ b/tests/reference/python-expr6-1a1d4fb.json @@ -6,7 +6,7 @@ "outfile": null, "outfile_hash": null, "stdout": "python-expr6-1a1d4fb.stdout", - "stdout_hash": "f7e339254436fdf45988c26786265c1d00bfcc23c0c5419fc07c0e6c", + "stdout_hash": "36557786797da33792a4a672d4f5e5b0a6ced2c51e674c5ad9426d62", "stderr": null, "stderr_hash": null, "returncode": 0 diff --git a/tests/reference/python-expr6-1a1d4fb.stdout b/tests/reference/python-expr6-1a1d4fb.stdout index ccb26aa61f..fe35320c4e 100644 --- a/tests/reference/python-expr6-1a1d4fb.stdout +++ b/tests/reference/python-expr6-1a1d4fb.stdout @@ -5,5 +5,3 @@ def test_ifexp(): a = 2 b = 6 if (a) == (2) else 8 c = True if (b) > (5) else False - - diff --git a/tests/tests.toml b/tests/tests.toml index b5d59c07e1..ea687ca0b0 100644 --- a/tests/tests.toml +++ b/tests/tests.toml @@ -131,6 +131,7 @@ asr = true filename = "expr14.py" llvm = true wat = true +python = true [[test]] filename = "expr15.py"