Home | History | Annotate | Download | only in python2.7

Lines Matching full:want

107 #  - Example: a <source, want> pair, plus an intra-docstring line number.
156 # Special string markers for use in `want` strings:
272 def _ellipsis_match(want, got):
278 if ELLIPSIS_MARKER not in want:
279 return want == got
282 ws = want.split(ELLIPSIS_MARKER)
312 # due to an ellipsis at the start or end of `want`. That's OK.
392 ## - An "example" is a <source, want> pair, where "source" is a
393 ## fragment of source code, and "want" is the expected output for
409 - want: The expected output from running the source code (either
410 from stdout, or a traceback in case of exception). `want` ends
436 def __init__(self, source, want, exc_msg=None, lineno=0, indent=0,
441 if want and not want.endswith('\n'):
442 want += '\n'
447 self.want = want
459 self.want == other.want and \
469 return hash((self.source, self.want, self.lineno, self.indent,
557 # `want` is the expected output (including leading indentation).
564 # Want consists of any non-blank lines that do not start with PS1.
565 (?P<want> (?:(?![ ]*$) # Not a blank line
571 # A regular expression for handling `want` strings that contain
572 # expected exceptions. It divides `want` into three pieces:
620 (source, options, want, exc_msg) = \
624 output.append( Example(source, want, exc_msg,
665 return a pair `(source, want)`, where `source` is the matched
667 and `want` is the example's expected output (with indentation
683 # Divide want into lines; check that it's properly indented; and
686 want = m.group('want')
687 want_lines = want.split('\n')
692 want = '\n'.join([wl[indent:] for wl in want_lines])
694 # If `want` contains a traceback message, then extract it.
695 m = self._EXCEPTION_RE.match(want)
704 return source, options, want, exc_msg
1182 if example.want:
1184 'Expecting:\n' + _indent(example.want))
1305 if check(example.want, got, self.optionflags):
1519 def check_output(self, want, got, optionflags):
1522 matches the expected output (`want`). These strings are
1531 if got == want:
1537 if (got,want) == ("True\n", "1\n"):
1539 if (got,want) == ("False\n", "0\n"):
1545 # Replace <BLANKLINE> in want with a blank line.
1546 want = re.sub('(?m)^%s\s*?$' % re.escape(BLANKLINE_MARKER),
1547 '', want)
1551 if got == want:
1559 want = ' '.join(want.split())
1560 if got == want:
1563 # The ELLIPSIS flag says to let the sequence "..." in `want`
1566 if _ellipsis_match(want, got):
1573 def _do_a_fancy_diff(self, want, got, optionflags):
1585 ##if optionflags & ELLIPSIS and ELLIPSIS_MARKER in want:
1594 return want.count('\n') > 2 and got.count('\n') > 2
1601 to compare `want` and `got`.
1603 want = example.want
1610 if self._do_a_fancy_diff(want, got, optionflags):
1611 # Split want & got into lines.
1612 want_lines = want.splitlines(True) # True == keep line ends
1635 if want and got:
1636 return 'Expected:\n%sGot:\n%s' % (_indent(want), _indent(got))
1637 elif want:
1638 return 'Expected:\n%sGot nothing\n' % _indent(want)
1699 >>> failure.example.want
1731 >>> failure.example.want
1855 can be called directly too, if you want to do something unusual.
1973 can be called directly too, if you want to do something unusual.
2241 >>> failure.example.want
2271 >>> failure.example.want
2382 # Why do we want to do this? Because it reveals a bug that might
2544 ... You can use logic if you want:
2571 # You can use logic if you want:
2586 want = piece.want
2587 if want:
2589 output += ['## '+l for l in want.split('\n')[:-1]]