@@ -505,22 +505,30 @@ class ConstrArgs(enum.Enum):
505505 if arg_type == None :
506506 corr_val_type = True
507507 break
508- if isinstance (arg . value , arg_type ):
508+ if isinstance (getattr ( arg , value_prop_name ) , arg_type ):
509509 corr_val_type = True
510510 break
511511
512512 if corr_val_type and corr_arg_type :
513513 # Accounts for additional checks for REPEATED and TAG_STR arguments
514514 if arg_idx == ConstrArgs .REPEATED :
515- if arg .value <= 0 :
515+ value = getattr (arg , value_prop_name )
516+ if value <= 0 :
516517 raise MalformedException (f"inline test: { self .arg_repeated_str } must be greater than 0" )
517- self .cur_inline_test .repeated = getattr ( arg , value_prop_name )
518+ self .cur_inline_test .repeated = value
518519 elif arg_idx == ConstrArgs .TAG_STR :
519520 tags = []
521+
522+ if sys .version_info < (3 , 8 , 0 ):
523+ elt_type = ast .Str
524+ else :
525+ elt_type = ast .Constant
526+
520527 for elt in arg .elts :
521- if not (isinstance (elt , ast .Constant ) and isinstance (elt .value , str )):
528+ value = getattr (elt , value_prop_name )
529+ if (not isinstance (elt , elt_type ) and isinstance (value , str )):
522530 raise MalformedException (f"tag can only be List of string" )
523- tags .append (getattr ( elt , value_prop_name ) )
531+ tags .append (value )
524532 self .cur_inline_test .tag = tags
525533 # For non-special cases, set the attribute defined by the dictionary
526534 else :
0 commit comments