Beispiel #1
0
def test_data_source_stdin():
    """
    Creates a new util.DataSource object with stdin input.  When calling
    util.DataSource.open(), this should set stdin as the DataSource.source
    for this object.
    """
    test_data_source = util.DataSource("-")
    test_data_source.open()
    assert_equals(test_data_source.source, sys.stdin)
Beispiel #2
0
def test_data_source_file():
    """
    Creates a new util.DataSource object with an uncompressed input file.  When calling
    util.DataSource.open(), this should set the file handle as the DataSource.source
    for this object. 
    DataSouce.source is verified against the contents of the input file.
    """
    test_data_source = util.DataSource(absolute_data_path("simplefile"))
    test_data_source.open()
    data_source_file_handle = test_data_source.source
    data_source_contents = data_source_file_handle.read()
    assert_equals(data_source_contents, "onionperf")
Beispiel #3
0
def test_data_source_compressed_file():
    """
    Creates a new util.DataSource object with a compressed input file.  When
    calling util.DataSource.open(), this should set the output of an xzprocess (an
    uncompressed file handle) as the DataSource.source for this object, and set
    DataSource.compress to True. 
    Verifies DataSource.compress is set to True. 
    DataSouce.source is verified against the contents of the input file.
    """
    test_data_source = util.DataSource(absolute_data_path("simplefile.xz"))
    test_data_source.open()
    data_source_file_handle = test_data_source.source
    data_source_contents = data_source_file_handle.read()
    assert_equals(data_source_contents, "onionperf")
    assert(test_data_source.compress)
Beispiel #4
0
def test_parsing_parse_error():
    parser = analysis.TGenParser()
    parser.parse(util.DataSource(DATA_DIR + 'parse_error'))