Skip to content

Commit 53341f3

Browse files
committed
Tests: Update tests and references
1 parent 020cf55 commit 53341f3

33 files changed

+182
-26
lines changed

tests/errors/test_dict_key4.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def test_dict_key4():
2+
print({[1, 2]: "first", [3, 4]: "second"})
3+
4+
test_dict_key4()

tests/errors/test_dict_key5.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def test_dict_key5():
2+
print({{1: "a", 2: "b"}: "first", {3: "c", 4: "d"}: "second"})
3+
4+
test_dict_key5()

tests/errors/test_dict_key6.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def test_dict_key6():
2+
print({{1, 2}: "first", {3, 4}: "second"})
3+
4+
test_dict_key6()

tests/errors/test_set_object4.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def test_set_object4():
2+
print({[1, 2], [3, 4]})
3+
4+
test_set_object4()

tests/errors/test_set_object5.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def test_set_object5():
2+
print({{1: "a", 2: "b"}, {3: "c", 4: "d"}})
3+
4+
test_set_object5()

tests/errors/test_set_object6.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def test_set_object6():
2+
print({{1, 2}, {3, 4}})
3+
4+
test_set_object6()

tests/reference/asr-test_dict7-1415e14.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"stdout": null,
99
"stdout_hash": null,
1010
"stderr": "asr-test_dict7-1415e14.stderr",
11-
"stderr_hash": "a51d1d4a46839e1f4258410e979ba83a14abe8c011482e30be2336cd",
11+
"stderr_hash": "843409ee199a2581d9cd1abab45bb59e5e0372d56ef94f1b15aea584",
1212
"returncode": 2
1313
}

tests/reference/asr-test_dict7-1415e14.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
semantic error: unhashable type in dict: 'slice'
1+
semantic error: Unhashable type in dict: 'slice'
22
--> tests/errors/test_dict7.py:4:11
33
|
44
4 | print(d[1:2])

tests/reference/asr-test_dict_key1-6e57a28.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"stdout": null,
99
"stdout_hash": null,
1010
"stderr": "asr-test_dict_key1-6e57a28.stderr",
11-
"stderr_hash": "ef02b1cd47e2290bcfb63a8e2d840795e9d40aa1c3b3f7f809239a25",
11+
"stderr_hash": "4ee828a6b9a93bfb8285c2006843243b5327f915f9548a2f1b3f1480",
1212
"returncode": 2
1313
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
semantic error: unhashable type: 'list'
2-
--> tests/errors/test_dict_key1.py:4:38
1+
semantic error: Unhashable type: 'list'
2+
--> tests/errors/test_dict_key1.py:4:19
33
|
44
4 | my_dict: dict[list[i32], str] = {[1, 2]: "first", [3, 4]: "second"}
5-
| ^^^^^^
5+
| ^^^^^^^^^ Mutable type 'list' cannot become a key in dict. Hint: Use an immutable type for key.

tests/reference/asr-test_dict_key2-18ea6fb.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"stdout": null,
99
"stdout_hash": null,
1010
"stderr": "asr-test_dict_key2-18ea6fb.stderr",
11-
"stderr_hash": "0b270d5c247762ec2f34814f686b4d044f53b582383778b399cfb5eb",
11+
"stderr_hash": "5883683aaf0a4ae56b5fd86f56f6900e3e752a72bc675af9c607d998",
1212
"returncode": 2
1313
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
semantic error: unhashable type: 'dict'
2-
--> tests/errors/test_dict_key2.py:4:43
1+
semantic error: Unhashable type: 'dict'
2+
--> tests/errors/test_dict_key2.py:4:19
33
|
44
4 | my_dict: dict[dict[i32, str], str] = {{1: "a", 2: "b"}: "first", {3: "c", 4: "d"}: "second"}
5-
| ^^^^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^^ Mutable type 'dict' cannot become a key in dict. Hint: Use an immutable type for key.

tests/reference/asr-test_dict_key3-9fc7793.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"stdout": null,
99
"stdout_hash": null,
1010
"stderr": "asr-test_dict_key3-9fc7793.stderr",
11-
"stderr_hash": "58ded690768c5c32ca9e82afce7a9b40458f3873ecc5056aa8d164e6",
11+
"stderr_hash": "bd995f8512a83892aa1be985c6f7ff1761691829150549ba4ac84f17",
1212
"returncode": 2
1313
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
semantic error: unhashable type: 'set'
2-
--> tests/errors/test_dict_key3.py:4:37
1+
semantic error: Unhashable type: 'set'
2+
--> tests/errors/test_dict_key3.py:4:19
33
|
44
4 | my_dict: dict[set[str], str] = {{1, 2}: "first", {3, 4}: "second"}
5-
| ^^^^^^
5+
| ^^^^^^^^ Mutable type 'set' cannot become a key in dict. Hint: Use an immutable type for key.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_dict_key4-dc7abfc",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_dict_key4.py",
5+
"infile_hash": "197ac00a9a0a5763f939d8b5aec2e33a5b3ec769d93149a1c93999c1",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_dict_key4-dc7abfc.stderr",
11+
"stderr_hash": "ff55c824acc6a3bc2c7f8845b345bcf5d66d13374526ab958a005dc7",
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: Unhashable type: 'list'
2+
--> tests/errors/test_dict_key4.py:2:12
3+
|
4+
2 | print({[1, 2]: "first", [3, 4]: "second"})
5+
| ^^^^^^ Mutable type 'list' cannot become a key in dict. Hint: Use an immutable type for key.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_dict_key5-87496d1",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_dict_key5.py",
5+
"infile_hash": "08a7118a664a5ac63f470b5a47d19ed7c35a06e3c8ae40a7b44010ea",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_dict_key5-87496d1.stderr",
11+
"stderr_hash": "c7ae39bf80d3a6d1817fbd7aba5455e96623b1225abeb9428af2c73a",
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: Unhashable type: 'dict'
2+
--> tests/errors/test_dict_key5.py:2:12
3+
|
4+
2 | print({{1: "a", 2: "b"}: "first", {3: "c", 4: "d"}: "second"})
5+
| ^^^^^^^^^^^^^^^^ Mutable type 'dict' cannot become a key in dict. Hint: Use an immutable type for key.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_dict_key6-1d334b2",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_dict_key6.py",
5+
"infile_hash": "14ea00618e1414afe9f93d0aa0d4fd5b4332883465126cbba6faab76",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_dict_key6-1d334b2.stderr",
11+
"stderr_hash": "74a8ee0549333b4659afc7deec824a14bbc672316b22e3c99a026846",
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: Unhashable type: 'set'
2+
--> tests/errors/test_dict_key6.py:2:12
3+
|
4+
2 | print({{1, 2}: "first", {3, 4}: "second"})
5+
| ^^^^^^ Mutable type 'set' cannot become a key in dict. Hint: Use an immutable type for key.

tests/reference/asr-test_set_object1-d9bd2e1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"stdout": null,
99
"stdout_hash": null,
1010
"stderr": "asr-test_set_object1-d9bd2e1.stderr",
11-
"stderr_hash": "41b650d67f9f8a83d7e4035b6ee06b5bc79a7c87fa1f7f3c57987b26",
11+
"stderr_hash": "b528f86f591ab403348d8dd5037d2385fdb7ce29501215a69d10702f",
1212
"returncode": 2
1313
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
semantic error: unhashable type: 'list'
2-
--> tests/errors/test_set_object1.py:4:31
1+
semantic error: Unhashable type: 'list'
2+
--> tests/errors/test_set_object1.py:4:17
33
|
44
4 | my_set: set[list[i32]] = {[1, 2], [3, 4]}
5-
| ^^^^^^
5+
| ^^^^^^^^^ Mutable type 'list' cannot be stored in a set.

tests/reference/asr-test_set_object2-41401ff.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"stdout": null,
99
"stdout_hash": null,
1010
"stderr": "asr-test_set_object2-41401ff.stderr",
11-
"stderr_hash": "9d53f9f23c857886b5d44deec31864d7f9de7c6e31f3bd2bca23d0de",
11+
"stderr_hash": "4fe845a8f949fce5b955b86d5a5ad60f0e1ae84e3c17b01572d37e2a",
1212
"returncode": 2
1313
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
semantic error: unhashable type: 'dict'
2-
--> tests/errors/test_set_object2.py:4:36
1+
semantic error: Unhashable type: 'dict'
2+
--> tests/errors/test_set_object2.py:4:17
33
|
44
4 | my_set: set[dict[i32, str]] = {{1: "a", 2: "b"}, {3: "c", 4: "d"}}
5-
| ^^^^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^^ Mutable type 'dict' cannot be stored in a set.

tests/reference/asr-test_set_object3-680b593.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"stdout": null,
99
"stdout_hash": null,
1010
"stderr": "asr-test_set_object3-680b593.stderr",
11-
"stderr_hash": "f2259d17c5dfa48f97003781cf7d2803108c06686dc7fa8f34509085",
11+
"stderr_hash": "05d3a6338fd929fef485c7403500a1f2111dc8e638a3369ff942bea2",
1212
"returncode": 2
1313
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
semantic error: unhashable type: 'set'
2-
--> tests/errors/test_set_object3.py:4:30
1+
semantic error: Unhashable type: 'set'
2+
--> tests/errors/test_set_object3.py:4:17
33
|
44
4 | my_set: set[set[i32]] = {{1, 2}, {3, 4}}
5-
| ^^^^^^
5+
| ^^^^^^^^ Mutable type 'set' cannot be stored in a set.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_set_object4-243eb04",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_set_object4.py",
5+
"infile_hash": "0b339aaa798fca7bd12920c583b0d60d70fe2f8afeb68a1811992f59",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_set_object4-243eb04.stderr",
11+
"stderr_hash": "dff44d0e30f3fed351e8df2bc1875c3a9972db927a58400df456ec12",
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: Unhashable type: 'list'
2+
--> tests/errors/test_set_object4.py:2:12
3+
|
4+
2 | print({[1, 2], [3, 4]})
5+
| ^^^^^^ Mutable type 'list' cannot be stored in a set.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_set_object5-4bd1044",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_set_object5.py",
5+
"infile_hash": "6d88885bb6428fe2b63121d653dcdfd23ec30d6b5322eb4cb8faada6",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_set_object5-4bd1044.stderr",
11+
"stderr_hash": "8727cfdabeed50ccf7989653e6607ebc8cb8b828c7388378d0fc33a6",
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: Unhashable type: 'dict'
2+
--> tests/errors/test_set_object5.py:2:12
3+
|
4+
2 | print({{1: "a", 2: "b"}, {3: "c", 4: "d"}})
5+
| ^^^^^^^^^^^^^^^^ Mutable type 'dict' cannot be stored in a set.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_set_object6-01b4fa7",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_set_object6.py",
5+
"infile_hash": "528a4e950b464e2915259ef826f2322c55efc268b2b5245add9fb6be",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_set_object6-01b4fa7.stderr",
11+
"stderr_hash": "45b2d173c7081a5410321802a3055c10e6277ec48ad0f2d1ef4dc60e",
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: Unhashable type: 'set'
2+
--> tests/errors/test_set_object6.py:2:12
3+
|
4+
2 | print({{1, 2}, {3, 4}})
5+
| ^^^^^^ Mutable type 'set' cannot be stored in a set.

tests/tests.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,18 @@ asr = true
10331033
filename = "errors/test_dict_key3.py"
10341034
asr = true
10351035

1036+
[[test]]
1037+
filename = "errors/test_dict_key4.py"
1038+
asr = true
1039+
1040+
[[test]]
1041+
filename = "errors/test_dict_key5.py"
1042+
asr = true
1043+
1044+
[[test]]
1045+
filename = "errors/test_dict_key6.py"
1046+
asr = true
1047+
10361048
[[test]]
10371049
filename = "errors/test_set_object1.py"
10381050
asr = true
@@ -1045,6 +1057,18 @@ asr = true
10451057
filename = "errors/test_set_object3.py"
10461058
asr = true
10471059

1060+
[[test]]
1061+
filename = "errors/test_set_object4.py"
1062+
asr = true
1063+
1064+
[[test]]
1065+
filename = "errors/test_set_object5.py"
1066+
asr = true
1067+
1068+
[[test]]
1069+
filename = "errors/test_set_object6.py"
1070+
asr = true
1071+
10481072
[[test]]
10491073
filename = "errors/test_dict8.py"
10501074
asr = true

0 commit comments

Comments
 (0)