Skip to content

Commit b082768

Browse files
Add tests for str.lower()
1 parent 76c783a commit b082768

File tree

47 files changed

+54
-47
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+54
-47
lines changed

integration_tests/test_str_attributes.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,12 @@ def capitalize():
77
s = " tom and jerry"
88
assert s.capitalize() == s
99

10-
capitalize()
1110

11+
def lower():
12+
s: str
13+
s = "AaaaAABBbbbbBB!@12223BN"
14+
assert s.lower() == "aaaaaabbbbbbbb!@12223bn"
15+
assert "DDd12Vv" .lower() == "ddd12vv"
16+
17+
capitalize()
18+
lower()

tests/reference/asr-complex1-f26c460.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "asr-complex1-f26c460.stdout",
9-
"stdout_hash": "1c6edc9727acaf64b86dfa4509353711166466b8b373e74a4b11cc9e",
9+
"stdout_hash": "0fb9cae39aefa01c8744f5657e256f05bb9efa74fefed59000535758",
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 {complex@__lpython_overloaded_0__complex: (ExternalSymbol 1 complex@__lpython_overloaded_0__complex 5 __lpython_overloaded_0__complex lpython_builtin [] __lpython_overloaded_0__complex Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 5 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_1__complex: (ExternalSymbol 1 complex@__lpython_overloaded_1__complex 5 __lpython_overloaded_1__complex lpython_builtin [] __lpython_overloaded_1__complex Public), complex@__lpython_overloaded_2__complex: (ExternalSymbol 1 complex@__lpython_overloaded_2__complex 5 __lpython_overloaded_2__complex lpython_builtin [] __lpython_overloaded_2__complex Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 5 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 5 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 83 {}) main_program [] []), test: (Function (SymbolTable 3 {x: (Variable 3 x Local () () Default (Complex 8 []) Source Public Required .false.), y: (Variable 3 y Local () () Default (Complex 8 []) Source Public Required .false.), z: (Variable 3 z Local () () Default (Complex 4 []) Source Public Required .false.)}) test [] [] [(= (Var 3 x) (ComplexBinOp (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) (ComplexConstant 2.000000 0.000000 (Complex 8 []))) Add (ComplexConstant 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) (ComplexConstant 2.000000 3.000000 (Complex 8 []))) ()) (= (Var 3 y) (ComplexBinOp (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) (ComplexConstant 5.000000 0.000000 (Complex 8 []))) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) (ComplexConstant 5.000000 5.000000 (Complex 8 []))) ()) (= (Var 3 z) (Cast (ComplexBinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (ComplexBinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (ComplexBinOp (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) (ComplexConstant 2.000000 0.000000 (Complex 8 []))) Mul (Var 3 x) (Complex 8 []) ()) ComplexToComplex (Complex 4 []) ()) ())] () Source Public Implementation () .false. .false. .false.), test_complex: (Function (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 4 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), c2: (Variable 2 c2 Local () () Default (Complex 4 []) Source Public Required .false.), c3: (Variable 2 c3 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 5 complex lpython_builtin [] complex Private)}) test_complex [] [] [(= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_0__complex 2 complex [] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) (ComplexConstant 0.000000 0.000000 (Complex 4 []))) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_1__complex 2 complex [((RealConstant 3.400000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) (ComplexConstant 3.400000 0.000000 (Complex 4 []))) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 5.000000 (Real 8 []))) ((RealConstant 4.300000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) (ComplexConstant 5.000000 4.300000 (Complex 4 []))) ()) (= (Var 2 c) (FunctionCall 1 complex@__lpython_overloaded_2__complex 2 complex [((IntegerConstant 1 (Integer 4 [])))] (Complex 4 []) (ComplexConstant 1.000000 0.000000 (Complex 8 [])) ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) (ComplexConstant 3.000000 4.000000 (Complex 4 []))) ()) (= (Var 2 c2) (Cast (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 4.500000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) (ComplexConstant 2.000000 4.500000 (Complex 4 []))) ()) (= (Var 2 c3) (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (ComplexCompare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) ()) ()) (= (Var 2 b) (ComplexCompare (Cast (Var 2 c1) ComplexToComplex (Complex 8 []) ()) Eq (Var 2 c3) (Logical 4 []) ()) ()) (= (Var 2 c) (ComplexBinOp (Var 2 c1) Add (Var 2 c2) (Complex 4 []) ()) ()) (= (Var 2 c) (ComplexBinOp (Var 2 c2) Sub (Var 2 c1) (Complex 4 []) ()) ()) (= (Var 2 c) (ComplexBinOp (Var 2 c1) Mul (Var 2 c2) (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (ComplexBinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.345340 (Real 8 []))) ((RealConstant 4.867868 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 0.015553 0.065561 (Complex 8 []))) ComplexToComplex (Complex 4 []) (ComplexConstant 0.015553 0.065561 (Complex 4 []))) ()) (= (Var 2 c) (Cast (ComplexBinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -5.000000 10.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) (ComplexConstant -5.000000 10.000000 (Complex 4 []))) ()) (= (Var 2 c) (Cast (ComplexBinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 1.000000 1.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) (ComplexConstant 1.000000 1.000000 (Complex 4 []))) ())] () Source Public Implementation () .false. .false. .false.)}) [])
1+
(TranslationUnit (SymbolTable 1 {complex@__lpython_overloaded_0__complex: (ExternalSymbol 1 complex@__lpython_overloaded_0__complex 5 __lpython_overloaded_0__complex lpython_builtin [] __lpython_overloaded_0__complex Public), complex@__lpython_overloaded_13__complex: (ExternalSymbol 1 complex@__lpython_overloaded_13__complex 5 __lpython_overloaded_13__complex lpython_builtin [] __lpython_overloaded_13__complex Public), complex@__lpython_overloaded_1__complex: (ExternalSymbol 1 complex@__lpython_overloaded_1__complex 5 __lpython_overloaded_1__complex lpython_builtin [] __lpython_overloaded_1__complex Public), complex@__lpython_overloaded_2__complex: (ExternalSymbol 1 complex@__lpython_overloaded_2__complex 5 __lpython_overloaded_2__complex lpython_builtin [] __lpython_overloaded_2__complex Public), complex@__lpython_overloaded_5__complex: (ExternalSymbol 1 complex@__lpython_overloaded_5__complex 5 __lpython_overloaded_5__complex lpython_builtin [] __lpython_overloaded_5__complex Public), complex@__lpython_overloaded_9__complex: (ExternalSymbol 1 complex@__lpython_overloaded_9__complex 5 __lpython_overloaded_9__complex lpython_builtin [] __lpython_overloaded_9__complex Public), lpython_builtin: (IntrinsicModule lpython_builtin), main_program: (Program (SymbolTable 84 {}) main_program [] []), test: (Function (SymbolTable 3 {x: (Variable 3 x Local () () Default (Complex 8 []) Source Public Required .false.), y: (Variable 3 y Local () () Default (Complex 8 []) Source Public Required .false.), z: (Variable 3 z Local () () Default (Complex 4 []) Source Public Required .false.)}) test [] [] [(= (Var 3 x) (ComplexBinOp (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) (ComplexConstant 2.000000 0.000000 (Complex 8 []))) Add (ComplexConstant 0.000000 3.000000 (Complex 8 [])) (Complex 8 []) (ComplexConstant 2.000000 3.000000 (Complex 8 []))) ()) (= (Var 3 y) (ComplexBinOp (Cast (IntegerConstant 5 (Integer 4 [])) IntegerToComplex (Complex 8 []) (ComplexConstant 5.000000 0.000000 (Complex 8 []))) Add (ComplexConstant 0.000000 5.000000 (Complex 8 [])) (Complex 8 []) (ComplexConstant 5.000000 5.000000 (Complex 8 []))) ()) (= (Var 3 z) (Cast (ComplexBinOp (Var 3 x) Add (Var 3 y) (Complex 8 []) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (ComplexBinOp (Var 3 x) Sub (Var 3 y) (Complex 8 []) ()) ComplexToComplex (Complex 4 []) ()) ()) (= (Var 3 z) (Cast (ComplexBinOp (Cast (IntegerConstant 2 (Integer 4 [])) IntegerToComplex (Complex 8 []) (ComplexConstant 2.000000 0.000000 (Complex 8 []))) Mul (Var 3 x) (Complex 8 []) ()) ComplexToComplex (Complex 4 []) ()) ())] () Source Public Implementation () .false. .false. .false.), test_complex: (Function (SymbolTable 2 {b: (Variable 2 b Local () () Default (Logical 4 []) Source Public Required .false.), c: (Variable 2 c Local () () Default (Complex 4 []) Source Public Required .false.), c1: (Variable 2 c1 Local () () Default (Complex 4 []) Source Public Required .false.), c2: (Variable 2 c2 Local () () Default (Complex 4 []) Source Public Required .false.), c3: (Variable 2 c3 Local () () Default (Complex 8 []) Source Public Required .false.), complex: (ExternalSymbol 2 complex 5 complex lpython_builtin [] complex Private)}) test_complex [] [] [(= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_0__complex 2 complex [] (Complex 8 []) (ComplexConstant 0.000000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) (ComplexConstant 0.000000 0.000000 (Complex 4 []))) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_1__complex 2 complex [((RealConstant 3.400000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.400000 0.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) (ComplexConstant 3.400000 0.000000 (Complex 4 []))) ()) (= (Var 2 c) (Cast (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 5.000000 (Real 8 []))) ((RealConstant 4.300000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 5.000000 4.300000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) (ComplexConstant 5.000000 4.300000 (Complex 4 []))) ()) (= (Var 2 c) (FunctionCall 1 complex@__lpython_overloaded_2__complex 2 complex [((IntegerConstant 1 (Integer 4 [])))] (Complex 4 []) (ComplexConstant 1.000000 0.000000 (Complex 8 [])) ()) ()) (= (Var 2 c1) (Cast (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) (ComplexConstant 3.000000 4.000000 (Complex 4 []))) ()) (= (Var 2 c2) (Cast (FunctionCall 1 complex@__lpython_overloaded_13__complex 2 complex [((IntegerConstant 2 (Integer 4 []))) ((RealConstant 4.500000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 2.000000 4.500000 (Complex 8 [])) ()) ComplexToComplex (Complex 4 []) (ComplexConstant 2.000000 4.500000 (Complex 4 []))) ()) (= (Var 2 c3) (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.000000 (Real 8 []))) ((RealConstant 4.000000 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) ()) (= (Var 2 b) (ComplexCompare (Var 2 c1) NotEq (Var 2 c2) (Logical 4 []) ()) ()) (= (Var 2 b) (ComplexCompare (Cast (Var 2 c1) ComplexToComplex (Complex 8 []) ()) Eq (Var 2 c3) (Logical 4 []) ()) ()) (= (Var 2 c) (ComplexBinOp (Var 2 c1) Add (Var 2 c2) (Complex 4 []) ()) ()) (= (Var 2 c) (ComplexBinOp (Var 2 c2) Sub (Var 2 c1) (Complex 4 []) ()) ()) (= (Var 2 c) (ComplexBinOp (Var 2 c1) Mul (Var 2 c2) (Complex 4 []) ()) ()) (= (Var 2 c) (Cast (ComplexBinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Pow (FunctionCall 1 complex@__lpython_overloaded_5__complex 2 complex [((RealConstant 3.345340 (Real 8 []))) ((RealConstant 4.867868 (Real 8 [])))] (Complex 8 []) (ComplexConstant 3.345340 4.867868 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 0.015553 0.065561 (Complex 8 []))) ComplexToComplex (Complex 4 []) (ComplexConstant 0.015553 0.065561 (Complex 4 []))) ()) (= (Var 2 c) (Cast (ComplexBinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 1 (Integer 4 []))) ((IntegerConstant 2 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 1.000000 2.000000 (Complex 8 [])) ()) Mul (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant -5.000000 10.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) (ComplexConstant -5.000000 10.000000 (Complex 4 []))) ()) (= (Var 2 c) (Cast (ComplexBinOp (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 4 (Integer 4 []))) ((IntegerConstant 5 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 4.000000 5.000000 (Complex 8 [])) ()) Sub (FunctionCall 1 complex@__lpython_overloaded_9__complex 2 complex [((IntegerConstant 3 (Integer 4 []))) ((IntegerConstant 4 (Integer 4 [])))] (Complex 8 []) (ComplexConstant 3.000000 4.000000 (Complex 8 [])) ()) (Complex 8 []) (ComplexConstant 1.000000 1.000000 (Complex 8 []))) ComplexToComplex (Complex 4 []) (ComplexConstant 1.000000 1.000000 (Complex 4 []))) ())] () Source Public Implementation () .false. .false. .false.)}) [])

tests/reference/asr-constants1-5828e8a.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "asr-constants1-5828e8a.stdout",
9-
"stdout_hash": "7dcb8b06f2aca6a55a692f6279fe5e2ef9bf95889b341ba210e6193f",
9+
"stdout_hash": "4f7c100b22c7451e2cc56df3f1d2ed5decc638d6efc28c75408dba1f",
1010
"stderr": null,
1111
"stderr_hash": null,
1212
"returncode": 0

tests/reference/asr-constants1-5828e8a.stdout

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tests/reference/asr-elemental_01-b58df26.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "asr-elemental_01-b58df26.stdout",
9-
"stdout_hash": "2e786242b0dabc3cba4a2c5fc811f52c902178614bb6284f4203a387",
9+
"stdout_hash": "52f08fe3c22ae923424955a3425dd5c97c873287cdb6d31684a31d78",
1010
"stderr": null,
1111
"stderr_hash": null,
1212
"returncode": 0

tests/reference/asr-elemental_01-b58df26.stdout

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tests/reference/asr-expr10-efcbb1b.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"outfile": null,
77
"outfile_hash": null,
88
"stdout": "asr-expr10-efcbb1b.stdout",
9-
"stdout_hash": "9a3334cfff10f91bc6a934cac5469202cbddc25a027c602242ccf1fc",
9+
"stdout_hash": "db931ec425335b752e963650bd4a6961dcb48404ea9415ff88635ebb",
1010
"stderr": null,
1111
"stderr_hash": null,
1212
"returncode": 0

0 commit comments

Comments
 (0)