Lines Matching refs:want

111 #  - Example: a <source, want> pair, plus an intra-docstring line number.
162 # Special string markers for use in `want` strings:
271 def _ellipsis_match(want, got):
277 if ELLIPSIS_MARKER not in want:
278 return want == got
281 ws = want.split(ELLIPSIS_MARKER)
311 # due to an ellipsis at the start or end of `want`. That's OK.
428 ## - An "example" is a <source, want> pair, where "source" is a
429 ## fragment of source code, and "want" is the expected output for
445 - want: The expected output from running the source code (either
446 from stdout, or a traceback in case of exception). `want` ends
472 def __init__(self, source, want, exc_msg=None, lineno=0, indent=0,
477 if want and not want.endswith('\n'):
478 want += '\n'
483 self.want = want
495 self.want == other.want and \
502 return hash((self.source, self.want, self.lineno, self.indent,
588 # `want` is the expected output (including leading indentation).
596 (?P<want> (?:(?![ ]*$) # Not a blank line
602 # A regular expression for handling `want` strings that contain
603 # expected exceptions. It divides `want` into three pieces:
651 (source, options, want, exc_msg) = \
655 output.append( Example(source, want, exc_msg,
696 return a pair `(source, want)`, where `source` is the matched
698 and `want` is the example's expected output (with indentation
714 # Divide want into lines; check that it's properly indented; and
717 want = m.group('want')
718 want_lines = want.split('\n')
723 want = '\n'.join([wl[indent:] for wl in want_lines])
725 # If `want` contains a traceback message, then extract it.
726 m = self._EXCEPTION_RE.match(want)
735 return source, options, want, exc_msg
1245 if example.want:
1247 'Expecting:\n' + _indent(example.want))
1368 if check(example.want, got, self.optionflags):
1597 def check_output(self, want, got, optionflags):
1600 matches the expected output (`want`). These strings are
1608 # If `want` contains hex-escaped character such as "\u1234",
1609 # then `want` is a string of six characters(e.g. [\,u,1,2,3,4]).
1611 # characters such as [\u1234], so `want` and `got` should
1614 want = self._toAscii(want)
1618 if got == want:
1624 if (got,want) == ("True\n", "1\n"):
1626 if (got,want) == ("False\n", "0\n"):
1632 # Replace <BLANKLINE> in want with a blank line.
1633 want = re.sub(r'(?m)^%s\s*?$' % re.escape(BLANKLINE_MARKER),
1634 '', want)
1638 if got == want:
1646 want = ' '.join(want.split())
1647 if got == want:
1650 # The ELLIPSIS flag says to let the sequence "..." in `want`
1653 if _ellipsis_match(want, got):
1660 def _do_a_fancy_diff(self, want, got, optionflags):
1672 ##if optionflags & ELLIPSIS and ELLIPSIS_MARKER in want:
1681 return want.count('\n') > 2 and got.count('\n') > 2
1688 to compare `want` and `got`.
1690 want = example.want
1697 if self._do_a_fancy_diff(want, got, optionflags):
1698 # Split want & got into lines.
1699 want_lines = want.splitlines(keepends=True)
1720 if want and got:
1721 return 'Expected:\n%sGot:\n%s' % (_indent(want), _indent(got))
1722 elif want:
1723 return 'Expected:\n%sGot nothing\n' % _indent(want)
1784 >>> failure.example.want
1816 >>> failure.example.want
1940 can be called directly too, if you want to do something unusual.
2058 can be called directly too, if you want to do something unusual.
2262 >>> failure.example.want
2292 >>> failure.example.want
2555 ... You can use logic if you want:
2582 # You can use logic if you want:
2597 want = piece.want
2598 if want:
2600 output += ['## '+l for l in want.split('\n')[:-1]]