Skip to content

Commit 8c72102

Browse files
committed
t/python: add extra OutputFormat coverage
Problem: The current OutputFormat python tests always assume output headers used in expandable width tests. Add some tests that set no_headers=True, so that the output headers are not taken into account.
1 parent 2cbdb9b commit 8c72102

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

t/python/t0024-util.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ def test_filter(self):
218218
).filter(items)
219219
self.assertEqual(fmt, "{i:>8} {f:5.2f}")
220220

221+
fmt = OutputFormat(
222+
"?+:{i:>7} ?:{s:>6} ?+:{f:.2f}", headings=self.headings
223+
).filter(items, no_header=True)
224+
self.assertEqual(fmt, "{i:>8} {f:3.2f}")
225+
221226
def test_sort(self):
222227
a = Item("a", 0, 2.2)
223228
d = Item("d", 33, 1.1)
@@ -270,6 +275,11 @@ def test_issue6530(self):
270275
).filter(items)
271276
self.assertEqual(fmt, "{s:16.16} {i:7d} {f:5.2f}")
272277

278+
fmt = OutputFormat(
279+
"+:{s:5.5} +:{i:4d} +:{f:.2f}", headings=self.headings
280+
).filter(items, no_header=True)
281+
self.assertEqual(fmt, "{s:16.16} {i:4d} {f:3.2f}")
282+
273283
def test_copy(self):
274284
original = "+:{s:5.5} {i:4d} {f:.2f}"
275285

0 commit comments

Comments
 (0)