API Reference for Enthought Tool Suite 3.0.1
Verifies that ConfigObj does what we expect with our project and context configspecs file. This is primarily a parsing test, and even though it strives to use the same format as our actual saved project files, it does not test actual object persistence or loading.
CONFIG_SPEC = 'project_config_spec.txt'
GENERATED_OUTPUT = [ '[Project]', ' active_experiment = exp1', '[Contexts]', ' [[C3]]', ' name = c3', ' file = test_c3_data.txt', ' [[C2]]', ' name = c2', ' file = test_c2_data.txt', ' [[C1]]', ' name = c1', ' file = test_c1_data.txt', '[Experiments]', ' [[E1]]', ' code_file = test_code.txt', ' name = exp1', ' shared_context = c2', ' save_dir = exp1', ' local_context = ""', ' layout_file = test_layout.txt', ' [[E2]]', ' code_file = code2.txt', ' layout_file = layout2.txt', ' name = exp2', ' save_dir = exp2' ]
This is a dict that corresponds to the TEST_LINES above. It can be used as a test target for correct parsing of the above.
TEST_DICT = { Const('Project') : Dict([(Const('active_experiment'), Const('exp1'))]), Const('Experiments') : Dict([(Const('E1'), Dict([(Const('name'), Const('exp1')), (Const('save_dir'), Const('exp1')), (Const('layout_file'), Const('test_layout.txt')), (Const('code_file'), Const('test_code.txt')), (Const('local_context'), Const('')), (Const('shared_context'), Const('c2'))])), (Const('E2'), Dict([(Const('name'), Const('exp2')), (Const('save_dir'), Const('exp2')), (Const('layout_file'), Const('layout2.txt')), (Const('code_file'), Const('code2.txt'))]))]), Const('Contexts') : Dict([(Const('C1'), Dict([(Const('name'), Const('c1')), (Const('file'), Const('test_c1_data.txt'))])), (Const('C2'), Dict([(Const('name'), Const('c2')), (Const('file'), Const('test_c2_data.txt'))])), (Const('C3'), Dict([(Const('name'), Const('c3')), (Const('file'), Const('test_c3_data.txt'))]))]) }
TEST_LINES = """
[Project]
active_experiment = "exp1"
[Experiments]
[[E1]]
name = "exp1"
save_dir = "exp1"
layout_file = "test_layout.txt"
code_file = "test_code.txt"
local_context = ""
shared_context = "c2"
[[E2]]
name = "exp2"
save_dir = "exp2"
layout_file = "layout2.txt"
code_file = "code2.txt"
[Contexts]
[[C1]]
name = "c1"
file = "test_c1_data.txt"
[[C2]]
name = "c2"
file = "test_c2_data.txt"
[[C3]]
name = "c3"
file = "test_c3_data.txt"
""".splitlines()
| Local name | Refers to |
|---|---|
| ConfigObj | configobj.ConfigObj |
| os | os |
| unittest | unittest |
© Copyright 2002-2008 Enthought, Inc.