def insist(self, condition=visible, *others, **kwargs): """ asserts conditions on self by default it is forced to assert without self pre-loading if available via _open (kwargs['forced']=True) """ opts = merge(dict(forced=True), kwargs) conditions = [condition] + list(others) acquire = self._finder if opts["forced"] else self._get wait_for(acquire, until=conditions) return self
def fill_with(self, opts=None, *other_opts, **opts_as_kwargs): """ fills fields of self with values passed in dicts in one of the following ways: as one dict via **kwargs in case the order of fields does not matter: fill_with(some_field="value", some_other_field="other value") as many dicts via *args if the order for some fields does matter: fill_with({"field1_should_be_set_first"="value"}, {"field_dependent_on_field1"="other value", "other_field": "some other value"}) """ if not opts: opts = {} list_of_opts = [merge(opts, opts_as_kwargs)] + list(other_opts) for options in list_of_opts: for (field, value) in iteritems(options): getattr(self._element, field).set(value) return self
def fill_with(self, opts=None, *other_opts, **opts_as_kwargs): """ fills fields of self with values passed in dicts in one of the following ways: as one dict via **kwargs in case the order of fields does not matter: fill_with(some_field="value", some_other_field="other value") as many dicts via *args if the order for some fields does matter: fill_with({"field1_should_be_set_first"="value"}, {"field_dependent_on_field1"="other value", "other_field": "some other value"}) """ if not opts: opts = {} list_of_opts = [merge(opts, opts_as_kwargs)] + list(other_opts) for options in list_of_opts: for (field, value) in options.iteritems(): getattr(self, field).set(value) # todo: think on: `adding (value != None) and` to the start, in case somebody would put None to the opts... return self