opentap/OpenTap.Python

Syntax issues with the example python code

Closed this issue · 0 comments

The code can be found here https://doc.opentap.io/OpenTap.Python/TAP_Python_Help/Code_Examples.html#python-code-examples

What the code is now

@attribute(Display("Example Test Step", "Test Step Description", "Examples")
class ExampleTestStep(TestStep)
    StepSetting = property(Int32, 10).add_attribute(OpenTap.Display("Step Setting"))
    
	def Run(self):
		self.log.Info("Running Test Step")
		self.UpgradeVerdict(OpenTap.Verdict.Pass)

What I changed to make it work

from opentap import *
from System import Int32
import OpenTap

@attribute(OpenTap.Display("Example Test Step", "Test Step Description", "Examples"))
class ExampleTestStep(TestStep):
    StepSetting = property(Int32, 10).add_attribute(OpenTap.Display("Step Setting"))
    def __init__(self):
        super(ExampleTestStep, self).__init__()
    
    def Run(self):
        self.log.Info("Running Test Step")
        self.UpgradeVerdict(OpenTap.Verdict.Pass)