diff options
Diffstat (limited to 'stdlib/source/test/lux/target/python.lux')
-rw-r--r-- | stdlib/source/test/lux/target/python.lux | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/stdlib/source/test/lux/target/python.lux b/stdlib/source/test/lux/target/python.lux index 2a9bdb68e..bca258d5e 100644 --- a/stdlib/source/test/lux/target/python.lux +++ b/stdlib/source/test/lux/target/python.lux @@ -61,22 +61,22 @@ {.#Some _} false))) (try.else false))) (_.cover [/.bool] - (expression (|>> (:as Bit) (bit#= bool)) + (expression (|>> (as Bit) (bit#= bool)) (/.bool bool))) (_.cover [/.int] - (expression (|>> (:as Int) (i.= int)) + (expression (|>> (as Int) (i.= int)) (/.int int))) ... (_.cover [/.long] - ... (expression (|>> (:as Int) (i.= int)) + ... (expression (|>> (as Int) (i.= int)) ... (/.long int))) (_.cover [/.float] - (expression (|>> (:as Frac) (f.= float)) + (expression (|>> (as Frac) (f.= float)) (/.float float))) (_.cover [/.string] - (expression (|>> (:as Text) (text#= string)) + (expression (|>> (as Text) (text#= string)) (/.string string))) (_.cover [/.unicode] - (expression (|>> (:as Text) (text#= string)) + (expression (|>> (as Text) (text#= string)) (/.unicode string))) ))) @@ -89,14 +89,14 @@ (~~ (template [</> <lux>] [(_.cover [</>] (let [expected (<lux> left right)] - (expression (|>> (:as Bit) (bit#= expected)) + (expression (|>> (as Bit) (bit#= expected)) (</> (/.bool left) (/.bool right)))))] [/.or .or] [/.and .and] )) (_.cover [/.not] - (expression (|>> (:as Bit) (bit#= (not left))) + (expression (|>> (as Bit) (bit#= (not left))) (/.not (/.bool left)))) )))) @@ -110,7 +110,7 @@ (~~ (template [</> <lux> <pre>] [(_.cover [</>] (let [expected (<lux> (<pre> parameter) (<pre> subject))] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (</> (/.float (<pre> parameter)) (/.float (<pre> subject))))))] [/.+ f.+ |>] @@ -123,7 +123,7 @@ (~~ (template [</> <lux>] [(_.cover [</>] (let [expected (<lux> parameter subject)] - (expression (|>> (:as Bit) (bit#= expected)) + (expression (|>> (as Bit) (bit#= expected)) (</> (/.float parameter) (/.float subject)))))] [/.< f.<] @@ -133,10 +133,10 @@ [/.= f.=] )) (_.cover [/.float/1] - (expression (|>> (:as Frac) (f.= subject)) + (expression (|>> (as Frac) (f.= subject)) (/.float/1 (/.string (%.frac subject))))) (_.cover [/.repr/1] - (expression (|>> (:as Text) (text#= (text.replaced "+" "" (%.frac subject)))) + (expression (|>> (as Text) (text#= (text.replaced "+" "" (%.frac subject)))) (/.repr/1 (/.float subject)))) )))) @@ -163,7 +163,7 @@ (~~ (template [</> <lux>] [(_.cover [</>] (let [expected (<lux> left right)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (</> (/.int left) (/.int right)))))] [/.bit_or i64.or] @@ -175,34 +175,34 @@ (let [left (.int shift) right (i.* (.int shift) i16) expected (<lux> left right)] - (expression (|>> (:as Int) (i.= expected)) + (expression (|>> (as Int) (i.= expected)) (</> (/.int left) (/.int right)))))] [/.// i./] )) (_.cover [/.opposite] - (expression (|>> (:as Int) (i.= (i.* -1 left))) + (expression (|>> (as Int) (i.= (i.* -1 left))) (/.opposite (/.int left)))) (_.cover [/.bit_shl] (let [expected (i64.left_shifted shift i16)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.bit_shl (/.int (.int shift)) (/.int i16))))) (_.cover [/.bit_shr] (let [expected (i.right_shifted shift i16)] - (expression (|>> (:as Frac) f.int (i.= expected)) + (expression (|>> (as Frac) f.int (i.= expected)) (/.bit_shr (/.int (.int shift)) (/.int i16))))) (_.cover [/.int/1] - (expression (|>> (:as Int) (i.= left)) + (expression (|>> (as Int) (i.= left)) (/.int/1 (/.string (%.int left))))) (_.cover [/.str/1] - (expression (|>> (:as Text) (text#= (text.replaced "+" "" (%.int left)))) + (expression (|>> (as Text) (text#= (text.replaced "+" "" (%.int left)))) (/.str/1 (/.int left)))) (_.cover [/.long] - (or (expression (|>> (:as Bit)) + (or (expression (|>> (as Bit)) ..python_3?) - (expression (|>> (:as Int) (i.= left)) + (expression (|>> (as Int) (i.= left)) (/.long left)))) )))) @@ -214,11 +214,11 @@ ($_ _.and (_.cover [/.chr/1 /.ord/1 /.unichr/1 /.unicode/1] - (and (expression (|>> (:as Int) .nat (n.= expected_code)) + (and (expression (|>> (as Int) .nat (n.= expected_code)) (/.? python_3? (/.ord/1 (/.chr/1 (/.int (.int expected_code)))) (/.unicode/1 (/.unichr/1 (/.int (.int expected_code)))))) - (expression (|>> (:as Text) (text#= expected_char)) + (expression (|>> (as Text) (text#= expected_char)) (/.? python_3? (/.chr/1 (/.ord/1 (/.string expected_char))) (/.unichr/1 (/.unicode/1 (/.string expected_char))))))) @@ -242,20 +242,20 @@ (_.for [/.item] ($_ _.and (_.cover [/.list] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.item (/.int (.int index)) (/.list (list#each /.float items))))) (_.cover [/.tuple] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.item (/.int (.int index)) (/.tuple (list#each /.float items))))))) (_.cover [/.slice /.len/1] - (expression (|>> (:as Int) (i.= (.int plus))) + (expression (|>> (as Int) (i.= (.int plus))) (|> (/.list (list#each /.float items)) (/.slice from to) /.len/1))) (_.cover [/.slice_from] - (expression (|>> (:as Int) (i.= (.int slice_from|size))) + (expression (|>> (as Int) (i.= (.int slice_from|size))) (|> (/.list (list#each /.float items)) (/.slice_from from) /.len/1))) @@ -272,12 +272,12 @@ dummy (/.string dummy)]] ($_ _.and (_.cover [/.dict] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.item field (/.dict (list [field (/.float expected)]))))) (_.cover [/.in?] - (and (expression (|>> (:as Bit) not) + (and (expression (|>> (as Bit) not) (/.in? (/.dict (list)) field)) - (expression (|>> (:as Bit)) + (expression (|>> (as Bit)) (/.in? (/.dict (list [field (/.float expected)])) field)))) ))) @@ -304,27 +304,27 @@ ..test|dict (_.cover [/.?] (let [expected (if test then else)] - (expression (|>> (:as Frac) (f.= expected)) + (expression (|>> (as Frac) (f.= expected)) (/.? (/.bool test) (/.float then) (/.float else))))) (_.cover [/.comment] - (expression (|>> (:as Frac) (f.= then)) + (expression (|>> (as Frac) (f.= then)) (/.comment comment (/.float then)))) (_.cover [/.__import__/1] (expression (function.constant true) (/.__import__/1 (/.string "math")))) (_.cover [/.do] - (expression (|>> (:as Frac) (f.= (math.ceil float))) + (expression (|>> (as Frac) (f.= (math.ceil float))) (|> (/.__import__/1 (/.string "math")) (/.do "ceil" (list (/.float float)))))) (_.cover [/.is] - (and (expression (|>> (:as Bit)) + (and (expression (|>> (as Bit)) (/.apply/* (list (/.string (format string string))) (/.lambda (list $arg/0) (/.is $arg/0 $arg/0)))) - (expression (|>> (:as Bit) not) + (expression (|>> (as Bit) not) (/.apply/* (list (/.string (format string string)) (/.string string)) (/.lambda (list $arg/0 $arg/1) @@ -342,12 +342,12 @@ $arg/2 (# ! each /.var (random.ascii/lower 12))] ($_ _.and (_.cover [/.lambda] - (expression (|>> (:as Frac) (f.= float/0)) + (expression (|>> (as Frac) (f.= float/0)) (/.apply/* (list) (/.lambda (list) (/.float float/0))))) (_.cover [/.apply/*] - (expression (|>> (:as Frac) (f.= ($_ f.+ float/0 float/1 float/2))) + (expression (|>> (as Frac) (f.= ($_ f.+ float/0 float/1 float/2))) (/.apply/* (list (/.float float/0) (/.float float/1) (/.float float/2)) (/.lambda (list $arg/0 $arg/1 $arg/2) ($_ /.+ $arg/0 $arg/1 $arg/2))))) @@ -370,20 +370,20 @@ $choice (# ! each (|>> %.nat (format "c") /.var) random.nat)] ($_ _.and (_.cover [/.Single /.SVar /.var] - (expression (|>> (:as Frac) (f.= expected/0)) + (expression (|>> (as Frac) (f.= expected/0)) (/.apply/* (list (/.float expected/0)) (/.lambda (list $var) $var)))) (_.for [/.Poly /.PVar] ($_ _.and (_.cover [/.poly] - (expression (|>> (:as Frac) (f.= expected/?)) + (expression (|>> (as Frac) (f.= expected/?)) (/.apply/* (list (/.int (.int poly_choice)) (/.float expected/0) (/.float expected/1)) (/.lambda (list $choice (/.poly $var)) (/.item $choice $var))))) (_.cover [/.splat_poly] - (expression (|>> (:as Frac) (f.= expected/?)) + (expression (|>> (as Frac) (f.= expected/?)) (/.apply/* (list (/.int (.int poly_choice)) (/.splat_poly (/.list (list (/.float expected/0) @@ -394,7 +394,7 @@ (_.for [/.Keyword /.KVar] ($_ _.and (_.cover [/.keyword] - (expression (|>> (:as Nat) (n.= 2)) + (expression (|>> (as Nat) (n.= 2)) (/.apply/* (list keyword_choice (/.splat_keyword (/.dict (list [keyword/0 (/.float expected/0)] @@ -402,7 +402,7 @@ (/.lambda (list $choice (/.keyword $var)) (/.len/1 $var))))) (_.cover [/.splat_keyword] - (expression (|>> (:as Frac) (f.= expected/?)) + (expression (|>> (as Frac) (f.= expected/?)) (/.apply/* (list keyword_choice (/.splat_keyword (/.dict (list [keyword/0 (/.float expected/0)] @@ -439,7 +439,7 @@ random.nat) environment (..dict [])] (exec - ("python exec" (/.code (it (/.var $output))) (:expected environment)) + ("python exec" (/.code (it (/.var $output))) (as_expected environment)) (Dict::get $output environment)))) (def: test|access @@ -452,7 +452,7 @@ ($_ _.and (_.cover [/.item] (`` (and (~~ (template [<seq>] - [(expression (|>> (:as Frac) (f.= expected/0)) + [(expression (|>> (as Frac) (f.= expected/0)) (/.item (/.int +0) (<seq> (list (/.float expected/0)))))] @@ -465,10 +465,10 @@ (/.set (list $var/0) (/.list (list (/.float dummy/0)))) (/.set (list (/.item (/.int +0) $var/0)) (/.float expected/0)) (/.set (list $output) (/.item (/.int +0) $var/0))))) - (:as Frac) + (as Frac) (f.= expected/0)) - (expression (|>> (:as Frac) (f.= expected/0)) + (expression (|>> (as Frac) (f.= expected/0)) (/.item field (/.dict (list [field (/.float expected/0)])))) (|> (..statement (function (_ $output) @@ -476,7 +476,7 @@ (/.set (list $var/0) (/.dict (list [field (/.float dummy/0)]))) (/.set (list (/.item field $var/0)) (/.float expected/0)) (/.set (list $output) (/.item field $var/0))))) - (:as Frac) + (as Frac) (f.= expected/0))))) ))) @@ -497,7 +497,7 @@ ($_ /.then (/.set (list $var/0) (/.float expected/0)) (/.set (list $output) $var/0)))) - (:as Frac) + (as Frac) (f.= expected/0))) (_.cover [/.multi] (`` (and (~~ (template [<var> <value>] @@ -506,7 +506,7 @@ ($_ /.then (/.set (list $var/0 $var/1) (/.multi (list (/.float expected/0) (/.float expected/1)))) (/.set (list $output) <var>)))) - (:as Frac) + (as Frac) (f.= <value>))] [$var/0 expected/0] @@ -519,7 +519,7 @@ (/.set (list $var/0) (/.list (list (/.float dummy/0) (/.float expected/0)))) (/.delete (/.item (/.int +0) $var/0)) (/.set (list $output) (/.item (/.int +0) $var/0))))) - (:as Frac) + (as Frac) (f.= expected/0)) (|> (..statement (function (_ $output) @@ -527,7 +527,7 @@ (/.set (list $var/0) (/.list (list (/.float dummy/0) (/.float expected/0)))) (/.delete (/.slice (/.int +0) (/.int +1) $var/0)) (/.set (list $output) (/.item (/.int +0) $var/0))))) - (:as Frac) + (as Frac) (f.= expected/0)) (|> (..statement (function (_ $output) @@ -536,7 +536,7 @@ (/.delete (/.slice_from (/.int +0) $var/0)) (/.statement (/.do "append" (list (/.float expected/0)) $var/0)) (/.set (list $output) (/.item (/.int +0) $var/0))))) - (:as Frac) + (as Frac) (f.= expected/0)) (|> (..statement (function (_ $output) @@ -544,7 +544,7 @@ (/.set (list $var/0) (/.dict (list [field/0 (/.float dummy/0)]))) (/.delete (/.item field/0 $var/0)) (/.set (list $output) (/.in? $var/0 field/0))))) - (:as Bit) + (as Bit) not) (|> (..statement (function (_ $output) @@ -553,7 +553,7 @@ (/.delete $var/0) (/.set (list $output) (/.or (/.in? /.locals/0 (/.string (/.code $var/0))) (/.in? /.globals/0 (/.string (/.code $var/0)))))))) - (:as Bit) + (as Bit) not) )) (_.cover [/.globals/0] @@ -567,7 +567,7 @@ (/.set (list $var/0) (/.float dummy/0)) (/.set (list $output) (/.and $output (/.in? /.globals/0 (/.string (/.code $var/0)))))))) - (:as Bit))) + (as Bit))) (_.cover [/.locals/0] (|> (..statement (function (_ $output) @@ -579,14 +579,14 @@ (/.set (list $var/0) (/.float dummy/0)) (/.set (list $output) (/.and $output (/.in? /.locals/0 (/.string (/.code $var/0)))))))) - (:as Bit))) + (as Bit))) (_.cover [/.import] (|> (..statement (function (_ $output) ($_ /.then (/.import "math") (/.set (list $output) (/.in? /.globals/0 (/.string "math")))))) - (:as Bit))) + (as Bit))) (_.for [/.Access] ..test|access) ))) @@ -620,7 +620,7 @@ (list [/.#classes (list "Exception") /.#exception $ex /.#handler (/.set (list $output) (/.float expected))])))) - (:as Frac) + (as Frac) (f.= expected)) (case (try (..statement (function (_ $output) @@ -661,7 +661,7 @@ $iteration)) ) {.#None})))) - (:as Nat) + (as Nat) (n.= expected)) (|> (..statement (function (_ $output) @@ -676,7 +676,7 @@ $iteration)) ) {.#Some (/.set (list $output) $temp)})))) - (:as Nat) + (as Nat) (n.= expected)))) (_.cover [/.for_in] (|> (..statement @@ -687,7 +687,7 @@ (/.list (list.repeated factor (/.int (.int base)))) (/.set (list $output) (/.+ $iteration $output)))))) - (:as Nat) + (as Nat) (n.= expected))) (_.cover [/.pass] (|> (..statement @@ -704,7 +704,7 @@ $output)) /.pass)) {.#None})))) - (:as Nat) + (as Nat) (n.= expected))) (_.cover [/.continue] (|> (..statement @@ -721,7 +721,7 @@ $output)) /.continue)) {.#None})))) - (:as Nat) + (as Nat) (n.= expected))) (_.cover [/.break] (|> (..statement @@ -738,7 +738,7 @@ (/.set (list $output) (/.+ (/.int (.int base)) $output)))) {.#None})))) - (:as Nat) + (as Nat) (n.= expected))) ))) @@ -760,7 +760,7 @@ (/.def $def (list $input/0) (/.return $input/0)) (/.set (list $output) (/.apply/* (list (/.float expected/0)) $def))))) - (:as Frac) + (as Frac) (f.= expected/0))) (_.cover [/.if] (|> (..statement @@ -771,7 +771,7 @@ (/.return (/.float then)) (/.return (/.float else)))) (/.set (list $output) (/.apply/* (list) $def))))) - (:as Frac) + (as Frac) (f.= expected/?))) (_.cover [/.when /.then] (|> (..statement @@ -783,7 +783,7 @@ (/.return (/.float then))) (/.return (/.float else)))) (/.set (list $output) (/.apply/* (list) $def))))) - (:as Frac) + (as Frac) (f.= expected/?))) (_.cover [/.statement] (|> (..statement @@ -794,14 +794,14 @@ (/.statement (/.+ (/.float expected/0) (/.float expected/0))) (/.return (/.float expected/0)))) (/.set (list $output) (/.apply/* (list) $def))))) - (:as Frac) + (as Frac) (f.= expected/0))) (_.cover [/.exec] (|> (..statement (function (_ $output) (/.exec {.#Some /.globals/0} (/.string (/.code (/.set (list $output) (/.float expected/0))))))) - (:as Frac) + (as Frac) (f.= expected/0))) ..test|exception (_.for [/.Location] @@ -833,7 +833,7 @@ (_.cover [/.code /.manual] (|> (/.manual (/.code expected)) - (: /.Expression) + (is /.Expression) (/#= expected))) (_.for [/.Expression] ..test|expression) |