예제 #1
0
def test_in_memory():
    # Write contents
    storage = MemoryStorage()
    storage.write(element)

    # Verify contents
    assert_equal(element, storage.read())
예제 #2
0
def test_in_memory():
    # Write contents
    storage = MemoryStorage()
    storage.write(element)

    # Verify contents
    assert_equal(element, storage.read())
예제 #3
0
    def __init__(self, path: PathType, **kwargs):
        """Create a new instance

        :param str path: Path to file"""
        if (not globals().get("auto_convert_to_pathlib", False)
                or locals().get("auto_convert_to_pathlib", False)):
            from . import auto_convert_to_pathlib

        current_path = auto_convert_to_pathlib(path)

        self.path = current_path

        MemoryStorage.__init__(self)
        JSONStorage.__init__(self, current_path, **kwargs)
예제 #4
0
def test_in_memory():
    # Write contents
    storage = MemoryStorage()
    storage.write(element)

    # Verify contents
    assert element == storage.read()

    # Test case for #21
    other = MemoryStorage()
    other.write({})
    assert other.read() != storage.read()
예제 #5
0
def test_in_memory():
    # Write contents
    storage = MemoryStorage()
    storage.write(doc)

    # Verify contents
    assert doc == storage.read()

    # Test case for #21
    other = MemoryStorage()
    other.write({})
    assert other.read() != storage.read()