<s> import numpy as np <EOL> from parakeet . analysis import mutability_analysis <EOL> from parakeet import make_array_type , Int64 , Bool , ptr_type , specialize <EOL> from parakeet . transforms . pipeline import lowering <EOL> from parakeet . testing_helpers import run_local_tests <EOL> def f ( x , y ) : <EOL> x [ <NUM_LIT:0> ] = True <EOL> return y <EOL> def test_mutable_array ( ) : <EOL> bool_vec = np . array ( [ True , False ] ) <EOL> int_vec = np . array ( [ <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> typed , _ , = specialize ( f , [ bool_vec , int_vec ] ) <EOL> mutable_types = mutability_analysis . find_mutable_types ( typed ) <EOL> int_array_t = make_array_type ( Int64 , <NUM_LIT:1> ) <EOL> bool_array_t = make_array_type ( Bool , <NUM_LIT:1> ) <EOL> assert int_array_t not in mutable_types , "<STR_LIT>" % ( int_array_t , mutable_types ) <EOL> assert bool_array_t in mutable_types , "<STR_LIT>" % ( bool_array_t , mutable_types ) <EOL> lowered = lowering . apply ( typed ) <EOL> mutable_types = mutability_analysis . find_mutable_types ( lowered ) <EOL> ptr_bool_t = ptr_type ( Bool ) <EOL> ptr_int_t = ptr_type ( Int64 ) <EOL> assert ptr_int_t not in mutable_types , "<STR_LIT>" % ( ptr_int_t , mutable_types ) <EOL> assert ptr_bool_t in mutable_types , "<STR_LIT>" % ( ptr_bool_t , mutable_types ) <EOL> """<STR_LIT>""" <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> run_local_tests ( ) </s>
