def test_filtered(self): stub_stdouts(self) parser = ArgumentParser() with self.assertRaises(SystemExit): parser.error('some random other error') self.assertIn('some random other error', sys.stderr.getvalue())
def test_error(self): stub_stdouts(self) parser = ArgumentParser() parser.error(_('too few arguments')) self.assertEqual('', sys.stdout.getvalue()) self.assertEqual('', sys.stderr.getvalue())