-
Notifications
You must be signed in to change notification settings - Fork 232
/
test_load_csv.py
69 lines (53 loc) · 1.77 KB
/
test_load_csv.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from optimus.tests.base import TestBase
class TestCSVPandas(TestBase):
def test_csv(self):
df = self.load_dataframe("examples/data/foo.csv")
self.assertEqual(df.rows.count(), 19)
self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"])
def test_csv_less_rows(self):
df = self.load_dataframe("examples/data/foo.csv", n_rows=13)
self.assertEqual(df.rows.count(), 13)
self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"])
def test_csv_more_rows(self):
df = self.load_dataframe("examples/data/foo.csv", n_rows=50)
self.assertLess(df.rows.count(), 50)
self.assertEqual(df.cols.names(), ["id", "firstName", "lastName", "billingId", "product", "price", "birth", "dummyCol"])
class TestCSVDask(TestCSVPandas):
config = {'engine': 'dask'}
class TestCSVPartitionDask(TestCSVPandas):
config = {'engine': 'dask', 'n_partitions': 2}
try:
import cudf # pyright: reportMissingImports=false
except:
pass
else:
class TestCSVCUDF(TestCSVPandas):
config = {'engine': 'cudf'}
try:
import dask_cudf # pyright: reportMissingImports=false
except:
pass
else:
class TestCSVDC(TestCSVPandas):
config = {'engine': 'dask_cudf'}
try:
import dask_cudf # pyright: reportMissingImports=false
except:
pass
else:
class TestCSVPartitionDC(TestCSVPandas):
config = {'engine': 'dask_cudf', 'n_partitions': 2}
try:
import pyspark
except:
pass
else:
class TestCSVSpark(TestCSVPandas):
config = {'engine': 'spark'}
try:
import vaex
except:
pass
else:
class TestCSVVaex(TestCSVPandas):
config = {'engine': 'vaex'}