コード例 #1
0
ファイル: TimeParser.py プロジェクト: N-Wouda/SMPS
 def _process_time(self, data_line: DataLine):
     if not data_line.has_second_header_word():
         msg = "Time file has no value for the TIME field."
         warnings.warn(msg)
         logger.warning(msg)
     else:
         self._name = data_line.second_header_word()
コード例 #2
0
ファイル: StochParser.py プロジェクト: N-Wouda/SMPS
 def _process_stoch(self, data_line: DataLine):
     if not data_line.has_second_header_word():
         msg = "Stoch file has no value for the STOCH field."
         warnings.warn(msg)
         logger.warning(msg)
     else:
         self._name = data_line.second_header_word()
コード例 #3
0
def test_header():
    """
    Tests if the DataLine class correctly parses section headers.
    """
    header_line = DataLine("ROWS")  # empty section header.
    assert_equal(header_line.first_header_word(), "ROWS")

    header_line = DataLine("INDEP         DISCRETE")  # parameterised header.
    assert_equal(header_line.first_header_word(), "INDEP")
    assert_equal(header_line.second_header_word(), "DISCRETE")
コード例 #4
0
def test_second_header_word(line, expected):
    """
    The second word field on a header line is the 15-72 column range
    (inclusive).
    """
    padding = "NAME" + " " * 10  # second data word starts at column 15.
    header_line = DataLine(padding + line)

    assert_(header_line.is_header())
    assert_equal(header_line.second_header_word(), expected)