Beispiel #1
0
def test_database_delete_value():
    """Test delete value operation.

    """
    database = TaskDatabase()
    database.set_value('root', 'val1', 1)
    assert database.get_value('root', 'val1') == 1
    database.delete_value('root', 'val1')
    with raises(KeyError):
        database.get_value('root', 'val1')
    with raises(KeyError):
        database.delete_value('root', 'val1')
Beispiel #2
0
def test_database_delete_value():
    """Test delete value operation.

    """
    database = TaskDatabase()
    database.set_value('root', 'val1', 1)
    assert database.get_value('root', 'val1') == 1
    database.delete_value('root', 'val1')
    with raises(KeyError):
        database.get_value('root', 'val1')
    with raises(KeyError):
        database.delete_value('root', 'val1')
Beispiel #3
0
def test_forbidden_operations():
    """Check that all forbidden operations does raise a RuntimeError.

    """
    database = TaskDatabase()
    database.prepare_to_run()
    with raises(RuntimeError):
        database.rename_values('root', [], [])
    with raises(RuntimeError):
        database.delete_value('root', '')
    with raises(RuntimeError):
        database.create_node('root', '')
    with raises(RuntimeError):
        database.rename_node('root', '', '')
    with raises(RuntimeError):
        database.delete_node('root', '')
Beispiel #4
0
def test_forbidden_operations():
    """Check that all forbidden operations does raise a RuntimeError.

    """
    database = TaskDatabase()
    database.prepare_to_run()
    with raises(RuntimeError):
        database.rename_values('root', [], [])
    with raises(RuntimeError):
        database.delete_value('root', '')
    with raises(RuntimeError):
        database.create_node('root', '')
    with raises(RuntimeError):
        database.rename_node('root', '', '')
    with raises(RuntimeError):
        database.delete_node('root', '')