Ejemplo n.º 1
0
 def test_fields_from(self):
     delim = '\t'
     input = "	0.1	hit a cell in a current user's booking	select cell	.cancelling"
     self.assertEqual(AsciiTable.fields_from(input, delim), [
         '', '0.1', "hit a cell in a current user's booking", 'select cell',
         '.cancelling'
     ])
     input = ""
     self.assertEqual(AsciiTable.fields_from(input, delim), [''])
     input = "\t"
     self.assertEqual(AsciiTable.fields_from(input, delim), ['', ''])
Ejemplo n.º 2
0
 def test_string_from(self):
     maxwidths = [10, 3, 10, 10, 10]
     fields = AsciiTable.fields_from(self.tsv_3_lines[2], self.tsv_delim)
     output = AsciiTable.string_from(maxwidths, fields)
     self.assertEqual(
         output,
         "|            | 0.1 | hit a cell | select cel | .cancellin |")
Ejemplo n.º 3
0
 def test_limited_lines(self):
     maxwidths = [10, 3, 10, 10, 10]
     fields = AsciiTable.fields_from(self.tsv_3_lines[2], self.tsv_delim)
     expected = [
         '|            | 0.1 | hit a      | select     | .cancellin |',
         '|            |     | cell in a  | cell       | g          |',
         '|            |     | current    |            |            |',
         "|            |     | user's     |            |            |",
         '|            |     | booking    |            |            |'
     ]
     output = AsciiTable.limited_lines(maxwidths, fields)
     self.assertEqual(output, expected)