From ccbb88ae408e6c712692ca1ac2698e0b7bfc6170 Mon Sep 17 00:00:00 2001 From: dours Date: Mon, 1 Aug 2022 13:31:29 +0300 Subject: [PATCH] add ValueError => another test works --- transpiler/src/main/eo/preface/xValueError.eo | 13 +++++++++++++ .../PrintLinearizedMutableEOWithCage.scala | 2 ++ .../break/while_try_except_else.yaml | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 transpiler/src/main/eo/preface/xValueError.eo diff --git a/transpiler/src/main/eo/preface/xValueError.eo b/transpiler/src/main/eo/preface/xValueError.eo new file mode 100644 index 000000000..50d4ecc02 --- /dev/null +++ b/transpiler/src/main/eo/preface/xValueError.eo @@ -0,0 +1,13 @@ ++package preface ++alias pyint preface.pyint ++alias return preface.return ++alias cage org.eolang.cage + +[] > xValueError + pyint 15 > x__id__ + [] > apply + [stackUp] > @ + cage result > pResult + [] > result + xValueError > x__class__ + stackUp.forward (return pResult) > @ diff --git a/transpiler/src/main/scala/org/polystat/py2eo/transpiler/PrintLinearizedMutableEOWithCage.scala b/transpiler/src/main/scala/org/polystat/py2eo/transpiler/PrintLinearizedMutableEOWithCage.scala index 1f62e223f..c24e15bd0 100644 --- a/transpiler/src/main/scala/org/polystat/py2eo/transpiler/PrintLinearizedMutableEOWithCage.scala +++ b/transpiler/src/main/scala/org/polystat/py2eo/transpiler/PrintLinearizedMutableEOWithCage.scala @@ -45,6 +45,7 @@ object PrintLinearizedMutableEOWithCage { "+alias xTypeError preface.xTypeError", "+alias xZeroDivisionError preface.xZeroDivisionError", "+alias xAssertionError preface.xAssertionError", + "+alias xValueError preface.xValueError", "+alias xrange preface.xrange", // "+alias sprintf org.eolang.txt.sprintf", "+junit", @@ -348,6 +349,7 @@ object PrintLinearizedMutableEOWithCage { "xStopIteration > dummy-stop-iteration", "xZeroDivisionError > dummy-xZeroDivisionError", "xAssertionError > dummy-xAssertionError", + "xValueError > dummy-xValueError", "xTypeError > dummy-xTypeError", "xiter > dummy-xiter", "xrange > dummy-xrange", diff --git a/transpiler/src/test/resources/org/polystat/py2eo/transpiler/simple-tests/simple-statements/break/while_try_except_else.yaml b/transpiler/src/test/resources/org/polystat/py2eo/transpiler/simple-tests/simple-statements/break/while_try_except_else.yaml index 86970ef2d..35eaaab13 100644 --- a/transpiler/src/test/resources/org/polystat/py2eo/transpiler/simple-tests/simple-statements/break/while_try_except_else.yaml +++ b/transpiler/src/test/resources/org/polystat/py2eo/transpiler/simple-tests/simple-statements/break/while_try_except_else.yaml @@ -1,4 +1,4 @@ -enabled: False +enabled: True python: | def while_try_except_else(): arr = [] @@ -12,5 +12,5 @@ python: | res = True arr.append(1) break - + return res and arr == [1] \ No newline at end of file