Skip to content

Commit a7c1115

Browse files
committed
Tests: Update tests and test references
1 parent 795df35 commit a7c1115

22 files changed

+193
-22
lines changed

integration_tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ RUN(NAME test_list_pop3 LABELS cpython llvm)
551551
RUN(NAME test_list_compare LABELS cpython llvm)
552552
RUN(NAME test_list_concat LABELS cpython llvm c NOFAST)
553553
RUN(NAME test_list_reserve LABELS cpython llvm)
554+
RUN(NAME test_const_list LABELS cpython llvm c)
554555
RUN(NAME test_tuple_01 LABELS cpython llvm c)
555556
RUN(NAME test_tuple_02 LABELS cpython llvm c NOFAST)
556557
RUN(NAME test_tuple_03 LABELS cpython llvm c)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from lpython import i32, i64, f32, f64, dict, list, tuple, str, Const, c64
1+
from lpython import i32, list, str, Const
22

33

4-
def test_list_const():
4+
def test_const_list():
55
CONST_INTEGER_LIST: Const[list[i32]] = [1, 2, 3, 4, 5, 1]
66

77
assert CONST_INTEGER_LIST.count(1) == 2
@@ -12,4 +12,4 @@ def test_list_const():
1212
assert CONST_STRING_LIST.index("RELEASE") == 2
1313

1414

15-
test_list_const()
15+
test_const_list()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from lpython import i32, list, Const
2+
3+
4+
def test_const_list_append():
5+
CONST_INTEGER_LIST: Const[list[i32]] = [1, 2, 3, 4, 5, 1]
6+
7+
CONST_INTEGER_LIST.append(6)
8+
9+
10+
test_const_list_append()

tests/errors/test_const_list_clear.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from lpython import i32, list, Const
2+
3+
4+
def test_const_list_clear():
5+
CONST_INTEGER_LIST: Const[list[i32]] = [1, 2, 3, 4, 5, 1]
6+
7+
CONST_INTEGER_LIST.clear()
8+
9+
10+
test_const_list_clear()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from lpython import i32, list, Const
2+
3+
4+
def test_const_list_insert():
5+
CONST_INTEGER_LIST: Const[list[i32]] = [1, 2, 3, 4, 5, 1]
6+
7+
CONST_INTEGER_LIST.insert(3, 8)
8+
9+
10+
test_const_list_insert()

tests/errors/test_const_list_pop.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from lpython import i32, list, Const
2+
3+
4+
def test_const_list_pop():
5+
CONST_INTEGER_LIST: Const[list[i32]] = [1, 2, 3, 4, 5, 1]
6+
7+
CONST_INTEGER_LIST.pop()
8+
9+
10+
test_const_list_pop()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from lpython import i32, list, Const
2+
3+
4+
def test_const_list_remove():
5+
CONST_INTEGER_LIST: Const[list[i32]] = [1, 2, 3, 4, 5, 1]
6+
7+
CONST_INTEGER_LIST.remove(1)
8+
9+
10+
test_const_list_remove()
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from lpython import i32, list, Const
2+
3+
4+
def test_const_list_reverse():
5+
CONST_INTEGER_LIST: Const[list[i32]] = [1, 2, 3, 4, 5, 1]
6+
7+
CONST_INTEGER_LIST.reverse()
8+
9+
10+
test_const_list_reverse()

tests/errors/test_list_const.py

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_const_list_append-ada1ade",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_const_list_append.py",
5+
"infile_hash": "1f8e9cdfaf24139c23d0a063fcce8c1765b0349500874c946c2a5bda",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_const_list_append-ada1ade.stderr",
11+
"stderr_hash": "84fe0a7a75edd73700bce92d3e43cdc85e7f3c58f0047f53fb4412ad",
12+
"returncode": 2
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
semantic error: cannot append element to a const list
2+
--> tests/errors/test_const_list_append.py:7:5
3+
|
4+
7 | CONST_INTEGER_LIST.append(6)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_const_list_clear-33bfae7",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_const_list_clear.py",
5+
"infile_hash": "df04c8c3b9063bbbe0a24443f962c70732fecef59a7418cd7d5182af",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_const_list_clear-33bfae7.stderr",
11+
"stderr_hash": "5c0c698319211c447c76e3309a027ee068dffded22d87bb3024cedf9",
12+
"returncode": 2
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
semantic error: cannot clear elements from a const list
2+
--> tests/errors/test_const_list_clear.py:7:5
3+
|
4+
7 | CONST_INTEGER_LIST.clear()
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_const_list_insert-4c81295",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_const_list_insert.py",
5+
"infile_hash": "d4a31ff954a49f096c46e38118ab88ac8821d5d691f1ada9ab323828",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_const_list_insert-4c81295.stderr",
11+
"stderr_hash": "148e2a44028dd423007236ebf7a2c393fcefa4e8c12aad565f1c87fe",
12+
"returncode": 2
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
semantic error: cannot insert element in a const list
2+
--> tests/errors/test_const_list_insert.py:7:5
3+
|
4+
7 | CONST_INTEGER_LIST.insert(3, 8)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_const_list_pop-568b207",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_const_list_pop.py",
5+
"infile_hash": "e6cae5dc10a6a3505b3227d8492f32859f5baef086c143b1afcacdbf",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_const_list_pop-568b207.stderr",
11+
"stderr_hash": "32d57cbb983509ca6c54bc0812c9a74b3c1886ecc94e635c5011c378",
12+
"returncode": 2
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
semantic error: cannot pop element from a const list
2+
--> tests/errors/test_const_list_pop.py:7:5
3+
|
4+
7 | CONST_INTEGER_LIST.pop()
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_const_list_remove-c5deb20",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_const_list_remove.py",
5+
"infile_hash": "e2bfdbf86ced2fae5e85037b6ea8479c1b73ab9b11b21c259739f8c1",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_const_list_remove-c5deb20.stderr",
11+
"stderr_hash": "3529d822548d9327dbd0eab32aebc7b4a0da518cc0a6c2356e65c7b8",
12+
"returncode": 2
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
semantic error: cannot remove element from a const list
2+
--> tests/errors/test_const_list_remove.py:7:5
3+
|
4+
7 | CONST_INTEGER_LIST.remove(1)
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_const_list_reverse-2df1a6f",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_const_list_reverse.py",
5+
"infile_hash": "b49f332d26356501f60c0342b86303deb62cd13621a821f3f2bc30c9",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_const_list_reverse-2df1a6f.stderr",
11+
"stderr_hash": "78d4df28bbde66600867165e7c4d2b7e56874ba0f459052f8ab1b7fc",
12+
"returncode": 2
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
semantic error: cannot reverse a const list
2+
--> tests/errors/test_const_list_reverse.py:7:5
3+
|
4+
7 | CONST_INTEGER_LIST.reverse()
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/tests.toml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,10 +487,6 @@ asr = true
487487
filename = "../integration_tests/global_syms_01.py"
488488
asr = true
489489

490-
[[test]]
491-
filename = "../integration_tests/test_list_const.py"
492-
asr = true
493-
494490
[[test]]
495491
filename = "cast.py"
496492
asr = true
@@ -832,7 +828,27 @@ filename = "errors/test_list_slicing.py"
832828
asr = true
833829

834830
[[test]]
835-
filename = "errors/test_list_const.py"
831+
filename = "errors/test_const_list_append.py"
832+
asr = true
833+
834+
[[test]]
835+
filename = "errors/test_const_list_clear.py"
836+
asr = true
837+
838+
[[test]]
839+
filename = "errors/test_const_list_insert.py"
840+
asr = true
841+
842+
[[test]]
843+
filename = "errors/test_const_list_pop.py"
844+
asr = true
845+
846+
[[test]]
847+
filename = "errors/test_const_list_reverse.py"
848+
asr = true
849+
850+
[[test]]
851+
filename = "errors/test_const_list_remove.py"
836852
asr = true
837853

838854
[[test]]

0 commit comments

Comments
 (0)