Changeset 1748:59ed56ce841c


Ignore:
Timestamp:
Jan 1, 2019, 2:04:13 PM (3 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
histedit_source:
a7abeee00f1d516f3fd4c7f956a962b76578638d,969cc07d05d55bbadd74d48fb81c324dc5c3ec2e
Message:
Add `ScriptedSession.dir` method

The result handling for this method is different from the default
result handling. `dir` will treat its `Call.result` attribute as
a multiline string and call the `callback` argument on each line
of this multiline string.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/scripted_session.py

    r1747 r1748  
    108108        return dummy_method
    109109
     110    def dir(self, path, callback):
     111        """
     112        Call the `callback` for each line in the multiline string
     113        `call.result`.
     114        """
     115        call = self._next_call(expected_method_name="dir")
     116        for line in call.result.splitlines():
     117            callback(line)
     118
    110119
    111120def factory(script):
Note: See TracChangeset for help on using the changeset viewer.