コード例 #1
0
def main(filename):
    """
    Create an instance of EveGenie from a json file. Then write it to file.

    :param filename: input filename
    :return:
    """
    print 'converting contents of {}'.format(filename)
    eg = EveGenie(filename=filename)
    outfile = '{}.settings.py'.format(filename.split('.')[0])
    eg.write_file(outfile)
    print 'settings file written to {}'.format(outfile)
コード例 #2
0
def test_output_file():
    """
    Tests writing schema to file and compares the files output to a control.

    :return:
    """
    outfile = parent_dir + '/tests/test_output'
    controlfile = parent_dir + '/tests/test.output.py'
    eg = EveGenie(data=test_data)

    with open(controlfile, 'r') as ifile:
        control = ifile.read()

    eg.write_file(outfile)
    with open(outfile, 'r') as ifile:
        test_schema = ifile.read()

    os.remove(outfile)
    assert (test_schema == control)
コード例 #3
0
ファイル: egtest.py プロジェクト: brianjking/evegenie
def test_output_file():
    """
    Tests writing schema to file and compares the files output to a control.

    :return:
    """
    outfile = parent_dir + '/tests/test_output'
    controlfile = parent_dir + '/tests/test.output.py'
    eg = EveGenie(data=test_data)

    with open(controlfile, 'r') as ifile:
        control = ifile.read()

    eg.write_file(outfile)
    with open(outfile, 'r') as ifile:
        test_schema = ifile.read()

    os.remove(outfile)
    assert(test_schema == control)