Ejemplo n.º 1
0
def test_Section_ne_1(simple_section):
    s0 = Section(init=simple_section)
    simple_section['options']['f'] = 34
    print("s0:")
    s0.dump()
    print()
    print("simple_section:")
    simple_section.dump()
    assert simple_section != s0
    assert s0 != simple_section
Ejemplo n.º 2
0
def test_Section_ne_1(simple_section):
    s0 = Section(init=simple_section)
    simple_section['options']['f'] = 34
    print("s0:")
    s0.dump()
    print()
    print("simple_section:")
    simple_section.dump()
    assert simple_section != s0
    assert s0 != simple_section
Ejemplo n.º 3
0
def test_Section_2(content):
    section = Section(dictionary=FlatMap(collections.OrderedDict()), init=content)
    section2 = Section(dictionary=FlatMap(collections.OrderedDict()), init=content)
    s_io = string_io()
    section.dump(stream=s_io)
    assert s_io.getvalue() == SECTION_DUMP
    section['sub']['y']['yfilename'] = 'y.dat'
    s_io1 = string_io()
    section.dump(stream=s_io1)
    assert s_io1.getvalue() != SECTION_DUMP
    s_io2 = string_io()
    section2.dump(stream=s_io2)
    assert s_io2.getvalue() == SECTION_DUMP
Ejemplo n.º 4
0
def test_Section_2(content):
    section = Section(dictionary=FlatMap(collections.OrderedDict()),
                      init=content)
    section2 = Section(dictionary=FlatMap(collections.OrderedDict()),
                       init=content)
    s_io = string_io()
    section.dump(stream=s_io)
    assert s_io.getvalue() == SECTION_DUMP
    section['sub']['y']['yfilename'] = 'y.dat'
    s_io1 = string_io()
    section.dump(stream=s_io1)
    assert s_io1.getvalue() != SECTION_DUMP
    s_io2 = string_io()
    section2.dump(stream=s_io2)
    assert s_io2.getvalue() == SECTION_DUMP
Ejemplo n.º 5
0
def test_Section_update(dictionary, simple_config_content, string_io):
    section = Section(dictionary=dictionary)
    section.update(simple_config_content)
    section.dump(stream=string_io)
    assert string_io.getvalue() == SIMPLE_SECTION_DUMP
Ejemplo n.º 6
0
def test_Section_create(generic_dictionary, string_io):
    section = Section(dictionary=generic_dictionary)
    section.dump(stream=string_io)
    assert string_io.getvalue() == ""
Ejemplo n.º 7
0
def test_Section_update(dictionary, simple_config_content, string_io):
    section = Section(dictionary=dictionary)
    section.update(simple_config_content)
    section.dump(stream=string_io)
    assert string_io.getvalue() == SIMPLE_SECTION_DUMP
Ejemplo n.º 8
0
def test_Section_create(generic_dictionary, string_io):
    section = Section(dictionary=generic_dictionary)
    section.dump(stream=string_io)
    assert string_io.getvalue() == ""
Ejemplo n.º 9
0
def test_Section_create(content, string_io):
    section = Section(dictionary=FlatMap(collections.OrderedDict()), init=content)
    section.dump(stream=string_io)
    assert string_io.getvalue() == SECTION_DUMP
Ejemplo n.º 10
0
def test_Section_create(content, string_io):
    section = Section(dictionary=FlatMap(collections.OrderedDict()),
                      init=content)
    section.dump(stream=string_io)
    assert string_io.getvalue() == SECTION_DUMP