Coverage for src/castep_linter/fortran/fortran_statement.py: 69%
10 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-11-23 18:07 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-11-23 18:07 +0000
1""""Module with base class for Fortran code parser classes"""
2from typing import ClassVar, List
4from castep_linter.fortran.fortran_node import Fortran, FortranNode
5from castep_linter.fortran.node_type_err import WrongNodeError
8class FortranStatementParser:
9 """Base class for fortran statement parsers"""
11 ALLOWED_NODES: ClassVar[List[Fortran]] = []
13 def __init__(self, node: FortranNode):
14 if not any(node.is_type(ftype) for ftype in self.ALLOWED_NODES): 14 ↛ exit, 14 ↛ 152 missed branches: 1) line 14 didn't finish the generator expression on line 14, 2) line 14 didn't jump to line 15, because the condition on line 14 was never true
15 err = f"{node.type} not in {self.ALLOWED_NODES}"
16 raise WrongNodeError(err)
18 self.node = node