Skip to content

Commit 85c8137

Browse files
committed
update tests
1 parent 5383f14 commit 85c8137

6 files changed

+24
-6
lines changed

tests/reference/asr-dictionary1-a105a36.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"basename": "asr-dictionary1-a105a36",
33
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
44
"infile": "tests/dictionary1.py",
5-
"infile_hash": "de60b11cae2fca92d379d49e16dff8e844880a8d399d5ce663fef743",
5+
"infile_hash": "d24f9165c2fb6f0441d774936dc2dfce99a0fec7225713607806a19a",
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "asr-dictionary1-a105a36.stdout",
9-
"stdout_hash": "01abb24628bd259575ffe0e0290ef41bdd4c8899fb8ca4e9d35af443",
9+
"stdout_hash": "e7bc564ba9f0544a67c0ff05f0825f70f8e56872521068389dd9134e",
1010
"stderr": null,
1111
"stderr_hash": null,
1212
"returncode": 0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(TranslationUnit (SymbolTable 1 {main_program: (Program (SymbolTable 4 {}) main_program [] []), test_Dict: (Subroutine (SymbolTable 2 {x: (Variable 2 x Local () () Default (Dict (Integer 4 []) (Integer 4 [])) Source Public Required .false.), y: (Variable 2 y Local () () Default (Dict (Character 1 -2 () []) (Integer 4 [])) Source Public Required .false.), z: (Variable 2 z Local () () Default (Integer 4 []) Source Public Required .false.)}) test_Dict [] [(= (Var 2 x) (DictConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] [(IntegerConstant 2 (Integer 4 [])) (IntegerConstant 4 (Integer 4 []))] (Dict (Integer 4 []) (Integer 4 []))) ()) (= (Var 2 y) (DictConstant [(StringConstant "a" (Character 1 1 () [])) (StringConstant "b" (Character 1 1 () []))] [(UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (UnaryOp USub (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 [])))] (Dict (Character 1 1 () []) (Integer 4 []))) ()) (= (Var 2 z) (ArrayRef 2 y [(() (StringConstant "a" (Character 1 1 () [])) ())] (Integer 4 []) ()) ()) (= (Var 2 z) (ArrayRef 2 y [(() (StringConstant "b" (Character 1 1 () [])) ())] (Integer 4 []) ()) ()) (= (Var 2 z) (ArrayRef 2 x [(() (IntegerConstant 1 (Integer 4 [])) ())] (Integer 4 []) ()) ())] Source Public Implementation () .false. .false.), test_dict_insert: (Subroutine (SymbolTable 3 {y: (Variable 3 y Local () () Default (Dict (Character 1 -2 () []) (Integer 4 [])) Source Public Required .false.)}) test_dict_insert [] [(= (Var 3 y) (DictConstant [(StringConstant "a" (Character 1 1 () [])) (StringConstant "b" (Character 1 1 () []))] [(UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (UnaryOp USub (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 [])))] (Dict (Character 1 1 () []) (Integer 4 []))) ()) (DictInsert 3 y (StringConstant "c" (Character 1 1 () [])) (UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))))] Source Public Implementation () .false. .false.)}) [])
1+
(TranslationUnit (SymbolTable 1 {main_program: (Program (SymbolTable 5 {}) main_program [] []), test_Dict: (Subroutine (SymbolTable 2 {x: (Variable 2 x Local () () Default (Dict (Integer 4 []) (Integer 4 [])) Source Public Required .false.), y: (Variable 2 y Local () () Default (Dict (Character 1 -2 () []) (Integer 4 [])) Source Public Required .false.), z: (Variable 2 z Local () () Default (Integer 4 []) Source Public Required .false.)}) test_Dict [] [(= (Var 2 x) (DictConstant [(IntegerConstant 1 (Integer 4 [])) (IntegerConstant 3 (Integer 4 []))] [(IntegerConstant 2 (Integer 4 [])) (IntegerConstant 4 (Integer 4 []))] (Dict (Integer 4 []) (Integer 4 []))) ()) (= (Var 2 y) (DictConstant [(StringConstant "a" (Character 1 1 () [])) (StringConstant "b" (Character 1 1 () []))] [(UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (UnaryOp USub (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 [])))] (Dict (Character 1 1 () []) (Integer 4 []))) ()) (= (Var 2 z) (ArrayRef 2 y [(() (StringConstant "a" (Character 1 1 () [])) ())] (Integer 4 []) ()) ()) (= (Var 2 z) (ArrayRef 2 y [(() (StringConstant "b" (Character 1 1 () [])) ())] (Integer 4 []) ()) ()) (= (Var 2 z) (ArrayRef 2 x [(() (IntegerConstant 1 (Integer 4 [])) ())] (Integer 4 []) ()) ())] Source Public Implementation () .false. .false.), test_dict_get: (Subroutine (SymbolTable 4 {x: (Variable 4 x Local () () Default (Integer 4 []) Source Public Required .false.), y: (Variable 4 y Local () () Default (Dict (Character 1 -2 () []) (Integer 4 [])) Source Public Required .false.)}) test_dict_get [] [(= (Var 4 y) (DictConstant [(StringConstant "a" (Character 1 1 () [])) (StringConstant "b" (Character 1 1 () []))] [(UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (UnaryOp USub (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 [])))] (Dict (Character 1 1 () []) (Integer 4 []))) ()) (= (Var 4 x) (DictItem 4 y (StringConstant "a" (Character 1 1 () [])) () (Integer 4 [])) ()) (= (Var 4 x) (DictItem 4 y (StringConstant "a" (Character 1 1 () [])) (IntegerConstant 0 (Integer 4 [])) (Integer 4 [])) ())] Source Public Implementation () .false. .false.), test_dict_insert: (Subroutine (SymbolTable 3 {y: (Variable 3 y Local () () Default (Dict (Character 1 -2 () []) (Integer 4 [])) Source Public Required .false.)}) test_dict_insert [] [(= (Var 3 y) (DictConstant [(StringConstant "a" (Character 1 1 () [])) (StringConstant "b" (Character 1 1 () []))] [(UnaryOp USub (IntegerConstant 1 (Integer 4 [])) (Integer 4 []) (IntegerConstant -1 (Integer 4 []))) (UnaryOp USub (IntegerConstant 2 (Integer 4 [])) (Integer 4 []) (IntegerConstant -2 (Integer 4 [])))] (Dict (Character 1 1 () []) (Integer 4 []))) ()) (DictInsert 3 y (StringConstant "c" (Character 1 1 () [])) (UnaryOp USub (IntegerConstant 3 (Integer 4 [])) (Integer 4 []) (IntegerConstant -3 (Integer 4 []))))] Source Public Implementation () .false. .false.)}) [])
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"basename": "asr-test_dict3-d28f38f",
3+
"cmd": "lpython --show-asr --no-color {infile} -o {outfile}",
4+
"infile": "tests/errors/test_dict3.py",
5+
"infile_hash": "c8930919a9c47244ed4c57c1235dd2000650eb61dbfb6f413ae934e0",
6+
"outfile": null,
7+
"outfile_hash": null,
8+
"stdout": null,
9+
"stdout_hash": null,
10+
"stderr": "asr-test_dict3-d28f38f.stderr",
11+
"stderr_hash": "e2cc26634c1ee7aeca96c006b3bd01205200e1a6187e01fde041c3b4",
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: Type mismatch in get's key value, the types must be compatible
2+
--> tests/errors/test_dict3.py:5:15
3+
|
4+
5 | x = y.get(1)
5+
| ^ type mismatch (found: 'i32', expected: 'str')

tests/reference/ast-dictionary1-1a7e00a.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"basename": "ast-dictionary1-1a7e00a",
33
"cmd": "lpython --show-ast --no-color {infile} -o {outfile}",
44
"infile": "tests/dictionary1.py",
5-
"infile_hash": "de60b11cae2fca92d379d49e16dff8e844880a8d399d5ce663fef743",
5+
"infile_hash": "d24f9165c2fb6f0441d774936dc2dfce99a0fec7225713607806a19a",
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "ast-dictionary1-1a7e00a.stdout",
9-
"stdout_hash": "a1ee1abcc12edf02f1947e80709e5515366025a7c13744b682e87fa9",
9+
"stdout_hash": "a4d907b481d700a454753881457ddb21264620b417ab442221241e1b",
1010
"stderr": null,
1111
"stderr_hash": null,
1212
"returncode": 0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(Module [(FunctionDef test_Dict ([] [] [] [] [] [] []) [(AnnAssign (Name x Store) (Subscript (Name dict Load) (Tuple [(Name i32 Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name x Store)] (Dict [(ConstantInt 1 ()) (ConstantInt 3 ())] [(ConstantInt 2 ()) (ConstantInt 4 ())]) ()) (AnnAssign (Name y Store) (Subscript (Name dict Load) (Tuple [(Name str Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name y Store)] (Dict [(ConstantStr "a" ()) (ConstantStr "b" ())] [(UnaryOp USub (ConstantInt 1 ())) (UnaryOp USub (ConstantInt 2 ()))]) ()) (AnnAssign (Name z Store) (Name i32 Load) () 1) (Assign [(Name z Store)] (Subscript (Name y Load) (ConstantStr "a" ()) Load) ()) (Assign [(Name z Store)] (Subscript (Name y Load) (ConstantStr "b" ()) Load) ()) (Assign [(Name z Store)] (Subscript (Name x Load) (ConstantInt 1 ()) Load) ())] [] () ()) (FunctionDef test_dict_insert ([] [] [] [] [] [] []) [(AnnAssign (Name y Store) (Subscript (Name dict Load) (Tuple [(Name str Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name y Store)] (Dict [(ConstantStr "a" ()) (ConstantStr "b" ())] [(UnaryOp USub (ConstantInt 1 ())) (UnaryOp USub (ConstantInt 2 ()))]) ()) (Assign [(Subscript (Name y Load) (ConstantStr "c" ()) Store)] (UnaryOp USub (ConstantInt 3 ())) ())] [] () ())] [])
1+
(Module [(FunctionDef test_Dict ([] [] [] [] [] [] []) [(AnnAssign (Name x Store) (Subscript (Name dict Load) (Tuple [(Name i32 Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name x Store)] (Dict [(ConstantInt 1 ()) (ConstantInt 3 ())] [(ConstantInt 2 ()) (ConstantInt 4 ())]) ()) (AnnAssign (Name y Store) (Subscript (Name dict Load) (Tuple [(Name str Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name y Store)] (Dict [(ConstantStr "a" ()) (ConstantStr "b" ())] [(UnaryOp USub (ConstantInt 1 ())) (UnaryOp USub (ConstantInt 2 ()))]) ()) (AnnAssign (Name z Store) (Name i32 Load) () 1) (Assign [(Name z Store)] (Subscript (Name y Load) (ConstantStr "a" ()) Load) ()) (Assign [(Name z Store)] (Subscript (Name y Load) (ConstantStr "b" ()) Load) ()) (Assign [(Name z Store)] (Subscript (Name x Load) (ConstantInt 1 ()) Load) ())] [] () ()) (FunctionDef test_dict_insert ([] [] [] [] [] [] []) [(AnnAssign (Name y Store) (Subscript (Name dict Load) (Tuple [(Name str Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name y Store)] (Dict [(ConstantStr "a" ()) (ConstantStr "b" ())] [(UnaryOp USub (ConstantInt 1 ())) (UnaryOp USub (ConstantInt 2 ()))]) ()) (Assign [(Subscript (Name y Load) (ConstantStr "c" ()) Store)] (UnaryOp USub (ConstantInt 3 ())) ())] [] () ()) (FunctionDef test_dict_get ([] [] [] [] [] [] []) [(AnnAssign (Name y Store) (Subscript (Name dict Load) (Tuple [(Name str Load) (Name i32 Load)] Load) Load) () 1) (Assign [(Name y Store)] (Dict [(ConstantStr "a" ()) (ConstantStr "b" ())] [(UnaryOp USub (ConstantInt 1 ())) (UnaryOp USub (ConstantInt 2 ()))]) ()) (AnnAssign (Name x Store) (Name i32 Load) () 1) (Assign [(Name x Store)] (Call (Attribute (Name y Load) get Load) [(ConstantStr "a" ())] []) ()) (Assign [(Name x Store)] (Call (Attribute (Name y Load) get Load) [(ConstantStr "a" ()) (ConstantInt 0 ())] []) ())] [] () ())] [])

0 commit comments

Comments
 (0)