2019-12-25 20:44:56 +01:00
from tiramisu import StrOption , OptionDescription , Leadership , Calculation , ParamValue , ParamOption , Params , calc_value
2019-04-08 08:41:33 +02:00
def get_description ( ) :
""" generate description for this test
"""
2019-12-24 15:24:20 +01:00
option = StrOption ( ' unicode ' , " Values ' test ' must show ' Unicode follower 3 ' " , multi = True )
option1 = StrOption ( ' unicode1 ' , " Unicode follower 1 " , multi = True )
option2 = StrOption ( ' unicode2 ' , " Unicode follower 2 " , multi = True )
2019-12-25 20:44:56 +01:00
hidden_property = Calculation ( calc_value ,
Params ( ParamValue ( ' hidden ' ) ,
2023-06-19 17:19:07 +02:00
kwargs = { ' condition ' : ParamOption ( option ) ,
2019-12-25 20:44:56 +01:00
' expected ' : ParamValue ( ' test ' ) ,
' reverse_condition ' : ParamValue ( True ) } ) )
option3 = StrOption ( ' unicode3 ' , " Unicode follower 3 " , properties = ( hidden_property , ) , multi = True )
2019-04-08 08:41:33 +02:00
descr1 = Leadership ( " unicode " , " Common configuration 1 " ,
[ option , option1 , option2 , option3 ] )
descr = OptionDescription ( " options " , " Common configuration 2 " , [ descr1 ] )
descr = OptionDescription ( " unicode1_leadership_requires_value " , " Leader followers with Unicode follower 3 hidden when Unicode follower 2 is test and modified value " , [ descr ] )
return descr
2023-04-15 16:12:35 +02:00
def get_values ( api , allpath = False ) :
2019-04-08 08:41:33 +02:00
if allpath :
root = ' unicode1_leadership_requires_value. '
else :
root = ' '
2023-04-15 16:12:35 +02:00
api . option ( root + ' options.unicode.unicode ' ) . value . set ( [ u ' test ' , u ' val2 ' ] )
api . option ( root + ' options.unicode.unicode1 ' , 0 ) . value . set ( u ' super1 ' )
api . option ( root + ' options.unicode.unicode1 ' , 1 ) . value . set ( u ' super2 ' )
api . option ( root + ' options.unicode.unicode2 ' , 0 ) . value . set ( u ' pas test ' )
api . option ( root + ' options.unicode.unicode2 ' , 1 ) . value . set ( u ' test ' )
api . option ( root + ' options.unicode.unicode3 ' , 1 ) . value . set ( u ' super ' )