コード例 #1
0
 def assertFixtureOutput(self, expected: PhaseFile, result: Result) -> None:
     """
     Asserts that the given stdout/stderr from the simple compiler matches
     the expected output from the `PhaseFile`.
     """
     # Wrap assertion errors in the exact command to invoke
     # (that can be copied and pasted) for convenience
     with assertion_context("while running: {}\n\n".format(result.cmd)):
         self.assertFixtureStdout(expected, result)
         self.assertFixtureStderr(expected, result)
コード例 #2
0
 def test_assertion_context_with_raise_assert(self):
     with self.assertRaisesRegex(AssertionError, 'foo bar'):
         with assertion_context('foo '):
             assert False, 'bar'
コード例 #3
0
 def test_assertion_context_with_no_raise(self):
     with assertion_context('foo '):
         pass
コード例 #4
0
 def test_assertion_context_with_raise_other(self):
     with self.assertRaisesRegex(Exception, 'something'):
         with assertion_context('foo '):
             raise Exception('something')