Exemplo n.º 1
0
def test_read():
    ini = INI('test.ini')
    assert ini.read('section0', 'integer') == 39
    assert np.isclose(ini.read('section1', 'float'), np.e)
    assert ini.read('section0', 'string') == 'hello world, this is an ini file'
    assert ini.read('section1', 'list') == ['Linux', 'rocks']
    #assert ini.read('section1', 'tuple') == ('Linux', 'rocks')
    assert ini.read('section0', 'none') is None
    assert ini.read('section1', 'true') is True
    assert ini.read('section1', 'false') is False
Exemplo n.º 2
0
def test_read():
    ini = INI("test.ini")
    assert ini.read("section0", "integer") == 39
    assert np.isclose(ini.read("section1", "float"), np.e)
    assert ini.read("section0", "string") == "hello world, this is an ini file"
    assert ini.read("section1", "list") == ["Linux", "rocks"]
    # assert ini.read('section1', 'tuple') == ('Linux', 'rocks')
    assert ini.read("section0", "none") is None
    assert ini.read("section1", "true") is True
    assert ini.read("section1", "false") is False
Exemplo n.º 3
0
def test_read():
    ini = INI("test.ini")
    assert ini.read("section0", "integer") == 39
    assert np.isclose(ini.read("section1", "float"), np.e)
    assert ini.read("section0", "string") == "hello world, this is an ini file"
    assert ini.read("section1", "list") == ["Linux", "rocks"]
    # assert ini.read('section1', 'tuple') == ('Linux', 'rocks')
    assert ini.read("section0", "none") is None
    assert ini.read("section1", "true") is True
    assert ini.read("section1", "false") is False
Exemplo n.º 4
0
def test_create():
    ini = INI("test.ini")
    ini.add_section("section0")
    ini.add_section("section1")
    ini.write("section0", "integer", 39)
    ini.write("section1", "float", np.e)
    ini.write("section0", "string", "hello world, this is an ini file")
    ini.write("section1", "list", ["Linux", "rocks"])
    ini.write("section1", "tuple", ("Linux", "rocks"))
    ini.write("section0", "none", None)
    ini.write("section1", "true", True)
    ini.write("section1", "false", False)
    ini.write("section0", "ndarray", np.linspace(0, 10, 21))
Exemplo n.º 5
0
def test_clear():
    ini = INI("test.ini")
    ini.clear()
    assert ini.sections == []
    os.remove("test.ini")
Exemplo n.º 6
0
def test_sections():
    ini = INI("test.ini")
    assert ini.sections == ["section0", "section1"]
Exemplo n.º 7
0
def test_has_section():
    ini = INI('test.ini')
    assert ini.has_section('section0')
    assert not ini.has_section('section9')
Exemplo n.º 8
0
def test_clear():
    ini = INI("test.ini")
    ini.clear()
    assert ini.sections == []
    os.remove("test.ini")
Exemplo n.º 9
0
def test_get_options():
    ini = INI("test.ini")
    assert ini.get_options("section0") == ["integer", "string", "none", "ndarray"]
Exemplo n.º 10
0
def test_has_option():
    ini = INI("test.ini")
    assert ini.has_option("section0", "integer")
    assert not ini.has_option("section0", "nooooooooooooo")
Exemplo n.º 11
0
def test_create():
    ini = INI('test.ini')
    ini.add_section('section0')
    ini.add_section('section1')
    ini.write('section0', 'integer', 39)
    ini.write('section1', 'float', np.e)
    ini.write('section0', 'string', 'hello world, this is an ini file')
    ini.write('section1', 'list', ['Linux', 'rocks'])
    ini.write('section1', 'tuple', ('Linux', 'rocks'))
    ini.write('section0', 'none', None)
    ini.write('section1', 'true', True)
    ini.write('section1', 'false', False)
    ini.write('section0', 'ndarray', np.linspace(0, 10, 21))
Exemplo n.º 12
0
def test_sections():
    ini = INI('test.ini')
    assert ini.sections == ['section0', 'section1']
Exemplo n.º 13
0
def test_get_options():
    ini = INI('test.ini')
    assert ini.get_options('section0') == ['integer', 'string', 'none', 'ndarray']
Exemplo n.º 14
0
def test_dictionary():
    ini = INI('test.ini')
    dict_ = ini.dictionary
    assert isinstance(dict_, dict)
    assert dict_['section0']['integer'] == '39'
Exemplo n.º 15
0
def test_has_option():
    ini = INI("test.ini")
    assert ini.has_option("section0", "integer")
    assert not ini.has_option("section0", "nooooooooooooo")
Exemplo n.º 16
0
def test_has_section():
    ini = INI("test.ini")
    assert ini.has_section("section0")
    assert not ini.has_section("section9")
Exemplo n.º 17
0
def test_has_section():
    ini = INI("test.ini")
    assert ini.has_section("section0")
    assert not ini.has_section("section9")
Exemplo n.º 18
0
def test_dictionary():
    ini = INI("test.ini")
    dict_ = ini.dictionary
    assert isinstance(dict_, dict)
    assert dict_["section0"]["integer"] == "39"
Exemplo n.º 19
0
def test_get_options():
    ini = INI("test.ini")
    assert ini.get_options("section0") == [
        "integer", "string", "none", "ndarray"
    ]
Exemplo n.º 20
0
def test_create():
    ini = INI("test.ini")
    ini.add_section("section0")
    ini.add_section("section1")
    ini.write("section0", "integer", 39)
    ini.write("section1", "float", np.e)
    ini.write("section0", "string", "hello world, this is an ini file")
    ini.write("section1", "list", ["Linux", "rocks"])
    ini.write("section1", "tuple", ("Linux", "rocks"))
    ini.write("section0", "none", None)
    ini.write("section1", "true", True)
    ini.write("section1", "false", False)
    ini.write("section0", "ndarray", np.linspace(0, 10, 21))
Exemplo n.º 21
0
def test_has_option():
    ini = INI('test.ini')
    assert ini.has_option('section0', 'integer')
    assert not ini.has_option('section0', 'nooooooooooooo')