def test_no_curses(self): # Make sure the patch works. with self.assertRaises(ImportError): misc_utils.import_curses() # Test functions that would require curses. self.assertEqual(0, misc_utils.get_screen_width()) self.assertEqual(0, misc_utils.get_screen_height())
def _render_text_formats(self, real_root, options_map, file, output_format): width = (self.args.width or misc_utils.get_screen_width() or self.default_width) postings = self.get_postings(real_root) try: journal_text.text_entries_table(file, postings, width, self.args.at_cost, self.args.render_balance, self.args.precision, self.args.verbosity, output_format) except ValueError as exc: raise report.ReportError(exc)
def test_get_screen_width(self): max_width = misc_utils.get_screen_width() self.assertTrue(type(int), max_width) # Note: Allow zero because the console function fails in nose when # capture is disabled. self.assertLess(-1, max_width)