Exemplo n.º 1
0
def test_create_new_sectioned_dat():
    with wrap() as wrapper:
        settings = {'canonical-name': "doc.txt"}
        data = Sectioned("doc.txt", ".txt", "def123", settings, wrapper)
        data.setup()

        data['alpha'] = "This is the first section."
        data['alpha']['abc'] = 123
        assert str(data['alpha']) == "This is the first section."

        data['beta'] = "This is the second section."
        data['beta']['def'] = 456

        assert str(data['alpha']) == "This is the first section."
        assert str(data['beta']) == "This is the second section."
        assert data['alpha']['abc'] == 123
        assert data['beta']['def'] == 456

        data['gamma'] = "This is the third section."
        del data['beta']
        assert data.keys() == ['alpha', 'gamma']
Exemplo n.º 2
0
def test_create_new_sectioned_dat():
    with wrap() as wrapper:
        settings = {"canonical-name": "doc.txt"}
        data = Sectioned("doc.txt", ".txt", "def123", settings, wrapper)
        data.setup()

        data["alpha"] = "This is the first section."
        data["alpha"]["abc"] = 123
        assert str(data["alpha"]) == "This is the first section."

        data["beta"] = "This is the second section."
        data["beta"]["def"] = 456

        assert str(data["alpha"]) == "This is the first section."
        assert str(data["beta"]) == "This is the second section."
        assert data["alpha"]["abc"] == 123
        assert data["beta"]["def"] == 456

        data["gamma"] = "This is the third section."
        del data["beta"]
        assert data.keys() == ["alpha", "gamma"]
Exemplo n.º 3
0
def test_create_new_sectioned_dat():
    with wrap() as wrapper:
        settings = {
                'canonical-name' : "doc.txt"
                }
        data = Sectioned("doc.txt", ".txt", "def123", settings, wrapper)
        data.setup()

        data['alpha'] = "This is the first section."
        data['alpha']['abc'] = 123
        assert str(data['alpha']) == "This is the first section."

        data['beta'] = "This is the second section."
        data['beta']['def'] = 456

        assert str(data['alpha']) == "This is the first section."
        assert str(data['beta']) == "This is the second section."
        assert data['alpha']['abc'] == 123
        assert data['beta']['def'] == 456

        data['gamma'] = "This is the third section."
        del data['beta']
        assert data.keys() == ['alpha', 'gamma']