Skip to content

Tests Structure

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

Constructs are listed according to the reference manual for python 3.8.1

Construct Construction(s)/Test cases Passed
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.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.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 2 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. break-continue with while break loop 2
  2. break-continue with while break loop 3
  3. break-continue with while break loop 4
  4. nested_while_continue
  5. break-continue with while continue loop 2
  6. nested_for_continue
  7. for_try_else_continue1
  8. for_try_else_continue2
  9. for_else_continue
  10. 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 2
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. break-continue with while break loop 2
  3. break-continue with while break loop 3
  4. break-continue with while break loop 4
  5. nested while break 1
  6. nested while break 2
  7. nested_while_continue
  8. break-continue with while continue loop 2
  9. nested while break 1
  10. nested while break 2
  11. while_break_else
  12. while_try_except_else
  13. while_try_except_finally
  14. while_try_break
  15. while_except
13 of 24
8.3 For
  1. for i in range: sum += i
  2. nested_for_break_1
  3. nested_for_break_2
  4. nested_for_break_3
  5. nested_for_continue
  6. for_try_else_continue1
  7. for_try_else_continue2
  8. for_try_break_else_finally
  9. for_try_break
  10. for_break
  11. for_try_else_break
  12. for_break_else
  13. for_else_continue
  14. for_try_continue_else_finally
15 of 43
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 def simple decorator
one function call from another
def in def
def in def
2 of 11
8.7 class def inheritance-test
multiple-inheritance
simple-class
simplest-derived-class
virtual-method-call
6 of 8
8.8 coroutines NOT SUPPORTED -
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

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