Test for empty input
Test for empty LISO files / empty parsed string. Right now the error message is "input node(s) must be specified", which is not helpful or indicative of the problem. This is because the parser's circuit builder first adds the input component, which needs nodes to be defined via uinput
or iinput
. The presence of these commands is only checked later, when the circuit is being validated.
Solution might be to store parsed stuff in a dict, and check if this is empty, rather than using class properties - but that's a lot of work.
Example test case:
class InvalidFileTestCase(LisoInputParserTestCase):
"""Voltage output command tests"""
def test_empty_string(self):
"""Test empty file"""
self.parser.parse("")
self.assertRaisesRegex(LisoParserError,
r"no circuit defined",
self.parser.solution)