Skip to content

Commit 71dc49f

Browse files
committed
ignore warnings
1 parent 424ec07 commit 71dc49f

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

_unittests/ut_df/test_streaming_dataframe.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from io import StringIO
88
import pandas
99
import numpy
10-
from pyquickhelper.pycode import ExtTestCase, get_temp_folder
10+
from pyquickhelper.pycode import (
11+
ExtTestCase, get_temp_folder, ignore_warnings)
1112
from pandas_streaming.data import dummy_streaming_dataframe
1213
from pandas_streaming.df import StreamingDataFrame
1314
from pandas_streaming.df.dataframe import StreamingDataFrameSchemaError
@@ -428,7 +429,8 @@ def test_merge_2(self):
428429
self.assertEqualDataFrame(jm.sort_values(["X", "Y"]).reset_index(drop=True),
429430
sjm.to_dataframe().sort_values(["X", "Y"]).reset_index(drop=True))
430431

431-
def test_schema_consistant(self):
432+
@ignore_warnings(ResourceWarning)
433+
def test_schema_consistent(self):
432434
df = pandas.DataFrame([dict(cf=0, cint=0, cstr="0"), dict(cf=1, cint=1, cstr="1"),
433435
dict(cf=2, cint="s2", cstr="2"), dict(cf=3, cint=3, cstr="3")])
434436
temp = get_temp_folder(__file__, "temp_schema_consistant")
@@ -454,11 +456,13 @@ def test_getitem(self):
454456
self.assertEqualDataFrame(df1[["cint"]], df2)
455457
self.assertRaise(lambda: sdf[:, "cint"], NotImplementedError)
456458

459+
@ignore_warnings(ResourceWarning)
457460
def test_read_csv_names(self):
458461
this = os.path.abspath(os.path.dirname(__file__))
459462
data = os.path.join(this, "data", "buggy_hash2.csv")
460-
df = pandas.read_csv(data, sep="\t", names=[
461-
"A", "B", "C"], header=None)
463+
df = pandas.read_csv(data, sep="\t",
464+
names=["A", "B", "C"],
465+
header=None)
462466
sdf = StreamingDataFrame.read_csv(
463467
data, sep="\t", names=["A", "B", "C"], chunksize=2, header=None)
464468
head = sdf.head(n=1)
@@ -512,7 +516,8 @@ def test_describe(self):
512516
self.assertEqual(['X', 'Y'], list(desc.columns))
513517
self.assertEqual(desc.loc['min', :].tolist(), [-0.5, 0])
514518
self.assertEqual(desc.loc['max', :].tolist(), [0.5, 100000])
515-
self.assertEqualArray(desc.loc['mean', :], numpy.array([0, 50000]))
519+
self.assertEqualArray(
520+
desc.loc['mean', :], numpy.array([0, 50000]), atol=1e-8)
516521
self.assertEqualArray(desc.loc['25%', :], numpy.array([-0.25, 25000]))
517522
self.assertEqualArray(desc.loc['50%', :], numpy.array([0.0, 50000]))
518523
self.assertEqualArray(desc.loc['75%', :], numpy.array([0.25, 75000]))
@@ -554,4 +559,4 @@ def test_set_item_function(self):
554559

555560

556561
if __name__ == "__main__":
557-
unittest.main()
562+
unittest.main(verbosity=2)

0 commit comments

Comments
 (0)