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_combinations(self): for width in (80, 200): for at_cost in True, False: for render_balance in True, False: for precision in (1, 2, 3, 5): for verbosity in (journal_text.COMPACT, journal_text.NORMAL, journal_text.VERBOSE): for output_format in (journal_text.FORMAT_TEXT, journal_text.FORMAT_CSV): oss = io.StringIO() journal_text.text_entries_table( oss, self.postings, width, at_cost, render_balance, precision, verbosity, output_format) self.assertTrue(oss.getvalue())
def test_narrow(self): oss = io.StringIO() with self.assertRaises(ValueError): journal_text.text_entries_table(oss, self.postings, 30, False, True, 4, journal_text.NORMAL, journal_text.FORMAT_TEXT)