<s> """<STR_LIT>""" <EOL> import unittest <EOL> import param <EOL> class TestCompositeParameters ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> class A ( param . Parameterized ) : <EOL> x = param . Number ( default = <NUM_LIT:0> ) <EOL> y = param . Number ( default = <NUM_LIT:0> ) <EOL> xy = param . Composite ( attribs = [ '<STR_LIT:x>' , '<STR_LIT:y>' ] ) <EOL> self . A = A <EOL> self . a = self . A ( ) <EOL> class SomeSequence ( object ) : <EOL> "<STR_LIT>" <EOL> def __init__ ( self , sequence ) : <EOL> self . sequence = sequence <EOL> self . index = <NUM_LIT:0> <EOL> def __call__ ( self ) : <EOL> val = self . sequence [ self . index ] <EOL> self . index += <NUM_LIT:1> <EOL> return val <EOL> self . SomeSequence = SomeSequence <EOL> def test_initialization ( self ) : <EOL> "<STR_LIT>" <EOL> self . assertEqual ( self . a . x , <NUM_LIT:0> ) <EOL> self . assertEqual ( self . a . y , <NUM_LIT:0> ) <EOL> self . assertEqual ( self . a . xy , [ <NUM_LIT:0> , <NUM_LIT:0> ] ) <EOL> def test_set_component ( self ) : <EOL> self . a . x = <NUM_LIT:1> <EOL> self . assertEqual ( self . a . xy , [ <NUM_LIT:1> , <NUM_LIT:0> ] ) <EOL> def test_set_compound ( self ) : <EOL> self . a . xy = ( <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> self . assertEqual ( self . a . x , <NUM_LIT:2> ) <EOL> self . assertEqual ( self . a . y , <NUM_LIT:3> ) <EOL> def test_compound_class ( self ) : <EOL> "<STR_LIT>" <EOL> self . assertEqual ( self . A . xy , [ <NUM_LIT:0> , <NUM_LIT:0> ] ) <EOL> def test_set_compound_class_set ( self ) : <EOL> self . A . xy = ( <NUM_LIT:5> , <NUM_LIT:6> ) <EOL> self . assertEqual ( self . A . x , <NUM_LIT:5> ) <EOL> self . assertEqual ( self . A . y , <NUM_LIT:6> ) <EOL> def test_set_compound_class_instance ( self ) : <EOL> self . A . xy = ( <NUM_LIT:5> , <NUM_LIT:6> ) <EOL> b = self . A ( ) <EOL> self . assertEqual ( b . x , <NUM_LIT:5> ) <EOL> self . assertEqual ( b . y , <NUM_LIT:6> ) <EOL> def test_set_compound_class_instance_unchanged ( self ) : <EOL> self . a . xy = ( <NUM_LIT:2> , <NUM_LIT:3> ) <EOL> self . A . xy = ( <NUM_LIT:5> , <NUM_LIT:6> ) <EOL> self . assertEqual ( self . a . x , <NUM_LIT:2> ) <EOL> self . assertEqual ( self . a . y , <NUM_LIT:3> ) <EOL> def test_composite_dynamic ( self ) : <EOL> """<STR_LIT>""" <EOL> a2 = self . A ( x = self . SomeSequence ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) , <EOL> y = self . SomeSequence ( [ <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> ] ) ) <EOL> a2 . x , a2 . y <EOL> self . assertEqual ( a2 . inspect_value ( '<STR_LIT>' ) , [ <NUM_LIT:1> , <NUM_LIT:4> ] ) <EOL> def test_composite_dynamic_generator ( self ) : <EOL> a2 = self . A ( x = self . SomeSequence ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) , <EOL> y = self . SomeSequence ( [ <NUM_LIT:4> , <NUM_LIT:5> , <NUM_LIT:6> ] ) ) <EOL> a2 . x , a2 . y <EOL> ix , iy = a2 . get_value_generator ( '<STR_LIT>' ) <EOL> self . assertEqual ( ix ( ) , <NUM_LIT:2> ) <EOL> self . assertEqual ( iy ( ) , <NUM_LIT:5> ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> import nose <EOL> nose . runmodule ( ) </s>
