コード例 #1
0
def test_io(doc = DOC_1):    
    p = docstring_to_file(doc, "test_yaml_doc.txt")
    assert doc == "\n".join([x[0] for x in yield_csv_rows(p)])
    y = get_yaml(p)
    assert y[0][0] == 'Something looking like a yaml'
    assert y[1]["key1"] == 'with two documents'
    delete_file(p)
コード例 #2
0
def test_io(doc=DOC_1):
    p = docstring_to_file(doc, "test_yaml_doc.txt")
    assert doc == "\n".join([x[0] for x in yield_csv_rows(p)])
    y = get_yaml(p)
    assert y[0][0] == 'Something looking like a yaml'
    assert y[1]["key1"] == 'with two documents'
    delete_file(p)
コード例 #3
0
def cfg_tests():
    # is cfg string equavalent to its reading? 
    import yaml
    assert list(yaml.load_all(doc_cfg_file_content)) == ref_reading_of_cfg_file 

    # is file with cfg string equavalent to its reading?
    from kep.file_io.specification import get_yaml
    assert get_yaml(cfg_path) == ref_reading_of_cfg_file 

    # does file with cfg string specify correct data structure?
    assert load_cfg(cfg_path) == ref_qualified_cfg_contents 
コード例 #4
0
def cfg_tests():
    # is cfg string equavalent to its reading?
    import yaml
    assert list(yaml.load_all(doc_cfg_file_content)) == ref_reading_of_cfg_file

    # is file with cfg string equavalent to its reading?
    from kep.file_io.specification import get_yaml
    assert get_yaml(cfg_path) == ref_reading_of_cfg_file

    # does file with cfg string specify correct data structure?
    assert load_cfg(cfg_path) == ref_qualified_cfg_contents
コード例 #5
0
 def test_io(self):
     p = docstring_to_file(self.DOC_1, "test_yaml_doc.txt")
     self.assertEqual(self.DOC_1, "\n".join([x[0] for x in yield_csv_rows(p)]))
     y = get_yaml(p)
     self.assertEqual(y[0][0], 'Something looking like a yaml')
     self.assertEqual(y[1]["key1"], 'with two documents')