def testStringEnum(self): empty = util.StringEnum() single = util.StringEnum('foo') self.assertEquals('foo', single.foo) multi = util.StringEnum('foo', 'bar') self.assertEquals('foo', multi.foo) self.assertEquals('bar', multi.bar)
def __init__(self, name, value, r=None): """Initializes this annotation with a name and value pair and a range. Args: name: Key name for this annotation. value: Value of this annotation. r: Range that this annotation is valid over. """ self.name = name self.value = value self.range = r or Range() ELEMENT_TYPE = util.StringEnum('INLINE_BLIP', 'INPUT', 'CHECK', 'LABEL', 'BUTTON', 'RADIO_BUTTON', 'RADIO_BUTTON_GROUP', 'PASSWORD', 'TEXTAREA', 'GADGET', 'IMAGE') class Element(object): """Elements are non-text content within a document. These are generally abstracted from the Robot. Although a Robot can query the properties of an element it can only interact with the specific types that the element represents. Properties of elements are both accesible directly (image.url) and through the properties dictionary (image.properties['url']). In general Element should not be instantiated by robots, but rather rely on the derrived classes. """