コード例 #1
0
def test_is_comment(line, expected):
    """
    Tests if the DataLine class correctly detects comment lines.
    """
    data_line = DataLine(line)
    assert_equal(data_line.is_comment(), expected)
コード例 #2
0
def test_repr():
    """
    Tests if the specific repr implementation is sensible.
    """
    data_line = DataLine(" N  OBJ")  # from the LandS.cor file.
    assert_equal(repr(data_line), "DataLine(' N  OBJ')")
コード例 #3
0
def test_len(length, string):
    """
    Tests if the __len__ function correctly looks at the raw string's length.
    """
    data_line = DataLine(string)
    assert_equal(len(data_line), length)
コード例 #4
0
def test_str():
    """
    Tests if the string representation is sensible.
    """
    data_line = DataLine(" N  OBJ")  # from the LandS.cor file.
    assert_equal(str(data_line), " N  OBJ")
コード例 #5
0
def test_indicator_columns(line, expected):
    """
    The indicator field is the 2-3 column range (inclusive).
    """
    data_line = DataLine(line)
    assert_equal(data_line.indicator(), expected)