Skip to content

Tests Structure

Andrew Goroshko edited this page Jul 28, 2022 · 127 revisions

Constructs are listed according to the reference manual for python 3.8.1

Construct Construction(s)/Test cases Passed
2.4. Literals checked by tests for 2.4.1, 2.4.5, 2.4.6 -
2.4.1. String and Bytes literals String literals test 1 of 1
2.4.6. Floating point literals Integer literals test 1 of 1
2.4.5. Integer literals Integer literals test 1 of 1
6.1 arithmetic conversion
  1. int + float
  2. int - float
  3. int *float
  4. int / float
  5. int * float - int
  6. int - complex
  7. int - complex
  8. float - complex
  9. int - complex
  10. int - complex
  11. float * complex
  12. float / complex
  13. float ** complex
  14. float * complex
  15. int - complex
  16. int + complex
  17. int * complex
  18. int / complex
  19. int ** complex
  20. int ** complex
18 of 20
6.16. Evaluation order
  1. evaluation from readme
  2. evaluation order plus
  3. operator test
3 of 3
6.2.4 displays checked by tests for 6.2.5-6.2.7 -
6.2.5 list display list_display ::= "[" [starred_list | comprehension] "]"
[some_action for i in some_range if condition]
another comprehension
list append
list length get
list get
list in another subset
list dynamic filling 1
list dynamic filling 2
4 of 9
6.2.6 set display set_display ::= "{" (starred_list | comprehension) "}"
{i *i for i in some_range}
0 of 2
6.2.7 dictionary display {key1_str: val1_str, key2_int: val2_list}
class in dictionary
{key1_str: val1_str, key2_int: val2_list}
{..., 1: some_list}
0 of 4
6.2.8 Generator expressions the tests 0 of 5
6.2.9 yield NOT SUPPORTED -
6.3.1 attribute reference tests 2 of 3
6.4 await NOT SUPPORTED -
6.2.3. Parenthesized forms
  1. parenthezied test 1
  2. parenthezied test 2
2 of 2
6.5 power operator 10 ** 2 == 100 1 of 1
6.6 Unary arithmetics unary ~, -, + 2 of 3
6.7 Binary arithmetics operations **, *, //, %, +, -, <<, >>, &, |, ^ 1 of 1
6.8 Shifting operations <<, >> 2 of 2
6.9 Binary bitwise operations &, ^, | 3 of 3
6.10 comparisons the tests 3 of 7
6.11 Boolean operations and, or, not 3 of 3
6.12 Assignment expressions Not yet supported -
6.13 Conditional expressions The tests 1 of 2
6.14 lambdas f = lambda x: some_X_action
f(5) == 50

list_var2 = list(filter(lambda x: (condition) , list_var1))
list_var2 = list(map(lambda x: action, list_var1))
2 of 4
7.1 Expression statements var:var_data_type=val if (cond) var = val_new1 else var = val_new2
var_1 = val
var_2 = val
var_3 = var_1 + var_2
0 of 2
7.2 Assign var1 = var2 = var3 = val
other regular assignments
6 of 8
7.2.1 Augmented +=, -=, *=, //=, <<=, %=, |=, &=, >>=,**=, ^=
1 of 1
7.2.2 Annotated annotated list items
annotated class field
annotated dictionary field
0 of 3
7.3 Assert assert in def call with condition
assert in def call with list action
conditional assert
assert with message
0 of 4
7.4 Pass simple pass
1 of 1
7.5 del NOT SUPPORTED -
7.6 return return bool 1
return bool 2
return int
return after return
4 of 4
7.7 yield NOT SUPPORTED -
7.8 raise try raise
try except raise
try except raise finally
2 of 3
7.9 break
  1. while_break1
  2. while_break2
  3. while_break3
  4. nested_while_break1
  5. nested while break 2
  6. while_break_else
  7. while_break_else
  8. while_try_except_else
  9. while_try_break
  10. while_except
  11. nested_for_break_1
  12. nested_for_break_2
  13. nested_for_break_3
  14. for_try_break_else_finally
  15. for_try_break
  16. for_try_else_break
  17. for_break_else
  18. for_break
13 of 20
7.10 Continue
  1. nested_while_continue
  2. break-continue with while continue loop 2
  3. nested_for_continue
  4. for_try_else_continue1
  5. for_try_else_continue2
  6. for_else_continue
  7. for_try_continue_else_finally
8 of 18
7.11 Import import own python module
import math python module
from math import pi
from math import *
import math python module and check its name
0 of 5
7.12 global NOT SUPPORTED -
7.13 nonlocal nonlocal_stmt ::= "nonlocal" identifier ("," identifier)*
nonlocal
0 of 1
8.1 if if some_condition: ... else: ...
if (var_1 != var_2)
if condition else action
if (condition): action else: action
13 of 10
8.2 while while test_expression: Body of while
  1. trivial
  2. else with while
  3. simple while test 1
  4. simple while test 2
  5. simple while test 3
  6. simple while test 4
  7. while from the readme
13 of 7
8.3 For
  1. for i in range: sum += i
  2. for from readme
  3. for with list appending
  4. for in range
5 of 5
8.4 Try some_statement except ExceptionType: handling_exception except: general_exception
try: some_statement raise: handle
try: some_statement except: handle -> else: handle_else
exceptions-finally
5 of 6
8.5 With with some class as
0 of 1
8.6 Function definition simple decorator
one function call from another
def in def
def in def
2 of 11
8.7 Class definition inheritance-test
multiple-inheritance
simple-class
simplest-derived-class
virtual-method-call
6 of 8
8.8 coroutines NOT SUPPORTED -
Additional loop tests
  1. for_try_else_continue_break
  2. for_try_else_finally
  3. nested_for_break_continue
  4. nested_for_break_continue_else
  5. nested_while_break_continue
  6. while_break_continue_1
  7. while_break_continue_2
  8. while_try_else_continue_break
  9. break-continue with while break loop 2
  10. break-continue with while break loop 3
  11. break-continue with while break loop 4
  12. nested while break 1
  13. nested while break 2
  14. nested_while_continue
  15. break-continue with while continue loop 2
  16. nested while break 1
  17. nested while break 2
  18. while_break_else
  19. while_try_except_else
  20. while_try_except_finally
  21. while_try_break
  22. while_except
  23. break-continue with while break loop 2
  24. break-continue with while break loop 3
  25. break-continue with while break loop 4
4 of 22
Print functionality print functionality test 1 of 1
Parser tests
  1. comments parsing
  2. explicit-line-joining
  3. indentation
  4. whitespaces
3 of 4
standard library set = {int, int}
{int, str, (float,str)}
set([int1, int2, int3])
set_var.add(variable)
set_var.update(variable)
set_var.discard(variable)
set_var.remove(variable)
set_var1
-
Broken Code Transpiler Check
  1. broken python syntax
  2. C++
  3. Java
  4. javaScript
  5. Python 3.10
5 of 5
Overall tests pass results 61.057693% (127 of 208)

Right now all tests are placed in this folder. All testing process can be divided on such stages:

  • processing input python code
  • simplifying it with AST usage
  • checking result code in system python interpreter
  • translating to the EO language

Then all tests except CPython and DJango will move through these stages:

  • translating from EO to the JAVA via maven plugin <---- link is required as I think
  • getting output from the plugin with java running results
  • integration with Polystat <---- need more info about this stage

Right now we have such test sets:

  • if - else
  • assignment
  • while
  • def - return
  • django tests
  • cpython tests (189100 non-blank lines)
  • django tests
  • assigning link to the object
  • loop with assigning together with break
  • inheritance

Tests description:

  1. if tests - support handling simple constructions of conditional operator if/else. A testing def return result of condition operator variable changing.
  2. assignment tests - support assigning value to variable. A testing def return True/False.
  3. while tests - support usage of while usage operator with test variable value asigning. A testing def return True/False.
  4. def tests - support testing of def with return availability. A testing def return True/False.
  5. cpython tests - support cloning remote repository from /cpython.git. The main problem of original cpython test is that in some tests exceptions can throw message which will be compared with constant string. In case of non equal message the test will fail. Also sometimes the error message can contain part of documentation, which thrown an exception, and in such case origin code line can not be parsed by our parser. That is why in this directory we have tests set which were fixed for better exception messages checking for preventing failures.
  6. django code parsing