File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,19 @@ def _message(self):
128128 )
129129
130130
131+ class NoHeaderBodyOrFooterError (TableOptionError ):
132+ """Exception raised when no header, body or footer is provided
133+
134+ This class is a subclass of :class:`TableOptionError`.
135+ """
136+
137+ def __init__ (self ):
138+ super ().__init__ (self ._message ())
139+
140+ def _message (self ) -> str :
141+ return "At least one of header, body or footer must be provided."
142+
143+
131144class InvalidCellPaddingError (TableOptionError ):
132145 """Exception raised when the cell padding is invalid
133146
Original file line number Diff line number Diff line change 11import pytest
22
33from table2ascii import table2ascii as t2a
4- from table2ascii .exceptions import BodyColumnCountMismatchError , FooterColumnCountMismatchError
4+ from table2ascii .exceptions import (
5+ BodyColumnCountMismatchError ,
6+ FooterColumnCountMismatchError ,
7+ NoHeaderBodyOrFooterError ,
8+ )
59
610
711def test_header_body_footer ():
@@ -117,6 +121,11 @@ def test_footer():
117121 assert text == expected
118122
119123
124+ def test_no_header_body_or_footer ():
125+ with pytest .raises (NoHeaderBodyOrFooterError ):
126+ t2a ()
127+
128+
120129def test_header_footer_unequal ():
121130 with pytest .raises (FooterColumnCountMismatchError ):
122131 t2a (
You can’t perform that action at this time.
0 commit comments