MCPcopy Create free account
hub / github.com/Pylons/webtest / get

Method get

webtest/forms.py:582–597  ·  view source on GitHub ↗

Get the named/indexed field object, or ``default`` if no field is found. Throws an AssertionError if no field is found and no ``default`` was given.

(self, name, index=None, default=utils.NoDefault)

Source from the content-addressed store, hash-verified

580 field.value = value
581
582 def get(self, name, index=None, default=utils.NoDefault):
583 """
584 Get the named/indexed field object, or ``default`` if no field is
585 found. Throws an AssertionError if no field is found and no ``default``
586 was given.
587 """
588 fields = self.fields.get(name)
589 if fields is None:
590 if default is utils.NoDefault:
591 raise AssertionError(
592 "No fields found matching %r (and no default given)"
593 % name)
594 return default
595 if index is None:
596 return self[name]
597 return fields[index]
598
599 def select(self, name, value=None, text=None, index=None):
600 """Like ``.set()``, except also confirms the target is a ``<select>``

Callers 15

selectMethod · 0.95
select_multipleMethod · 0.95
__init__Method · 0.45
_form_elt_filterMethod · 0.45
_parse_fieldsMethod · 0.45
__setitem__Method · 0.45
__getitem__Method · 0.45
setMethod · 0.45
__call__Method · 0.45
_followMethod · 0.45
_find_elementMethod · 0.45
PyQueryMethod · 0.45

Calls

no outgoing calls

Tested by 15

callFUTMethod · 0.36
test_no_formMethod · 0.36
test_too_many_formsMethod · 0.36
test_inputMethod · 0.36
test_input_unicodeMethod · 0.36