示例#1
0
def test_readjson_chunks_closes(chunksize):
    with ensure_clean("test.json") as path:
        df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
        df.to_json(path, lines=True, orient="records")
        reader = JsonReader(
            path,
            orient=None,
            typ="frame",
            dtype=True,
            convert_axes=True,
            convert_dates=True,
            keep_default_dates=True,
            numpy=False,
            precise_float=False,
            date_unit=None,
            encoding=None,
            lines=True,
            chunksize=chunksize,
            compression=None,
        )
        reader.read()
        assert (
            reader.open_stream.closed
        ), "didn't close stream with \
            chunksize = {chunksize}".format(
            chunksize=chunksize
        )
示例#2
0
def test_readjson_chunks_closes(chunksize):
    with ensure_clean('test.json') as path:
        df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
        df.to_json(path, lines=True, orient="records")
        reader = JsonReader(
            path, orient=None, typ="frame", dtype=True, convert_axes=True,
            convert_dates=True, keep_default_dates=True, numpy=False,
            precise_float=False, date_unit=None, encoding=None,
            lines=True, chunksize=chunksize, compression=None)
        reader.read()
        assert reader.open_stream.closed, "didn't close stream with \
            chunksize = %s" % chunksize
def test_readjson_chunks_closes(chunksize):
    with ensure_clean('test.json') as path:
        df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
        df.to_json(path, lines=True, orient="records")
        reader = JsonReader(
            path, orient=None, typ="frame", dtype=True, convert_axes=True,
            convert_dates=True, keep_default_dates=True, numpy=False,
            precise_float=False, date_unit=None, encoding=None,
            lines=True, chunksize=chunksize)
        reader.read()
        assert reader.open_stream.closed, "didn't close stream with \
            chunksize = %s" % chunksize