File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,26 @@ class JobNotReadyException(Exception):
114114 pass
115115
116116def trailing (template , * targets ):
117+ """Substring of *template* following all *targets*.
118+
119+ Most easily explained by example::
120+
121+ template = "this is a test of the bunnies."
122+ trailing(template, "is", "est", "the") == \
123+ " bunnies"
124+
125+ Each target is matched successively in the string, and the string
126+ remaining after the last target is returned. If one of the targets
127+ fails to match, a ValueError is raised.
128+
129+ :param template: Template to extract a trailing string from.
130+ :type template: string
131+ :param targets: Strings to successively match in *template*.
132+ :type targets: strings
133+ :returns: Trailing string after all targets are matched.
134+ :rtype: string
135+ :raises ValueError: when one of the targets does not match.
136+ """
117137 s = template
118138 for t in targets :
119139 n = s .find (t )
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ def test_results(self):
173173 # here as a caution to future generations:
174174 # self.assertRaises(ValueError, job.results)
175175 while not job .isDone ():
176- pass
176+ sleep ( 1 )
177177 reader = results .ResultsReader (job .results (timeout = 60 ))
178178 job .refresh ()
179179 self .assertEqual (job ['isDone' ], '1' )
@@ -187,7 +187,7 @@ def test_results(self):
187187 # Repeat the same thing, but without the .is_preview reference.
188188 job = jobs .create ("search index=_internal | head 1 | stats count" )
189189 while not job .isDone ():
190- pass
190+ sleep ( 1 )
191191 reader = results .ResultsReader (job .results (timeout = 60 ))
192192 job .refresh ()
193193 self .assertEqual (job ['isDone' ], '1' )
You can’t perform that action at this time.
0 commit comments