24
24
class TestBsonToArrowConversionBase (TestCase ):
25
25
def setUp (self ):
26
26
self .schema = Schema ({"_id" : ObjectId , "data" : int64 (), "title" : string ()})
27
- self .context = PyMongoArrowContext . from_schema (self .schema )
27
+ self .context = PyMongoArrowContext (self .schema )
28
28
29
29
@staticmethod
30
30
def _generate_payload (doclist ):
@@ -36,7 +36,7 @@ def _generate_payload(doclist):
36
36
def _run_test (self , doclist , as_dict ):
37
37
payload = type (self )._generate_payload (doclist )
38
38
39
- process_bson_stream ( payload , self .context )
39
+ self .context . process_bson_stream ( payload )
40
40
table = self .context .finish ()
41
41
table_dict = table .to_pydict ()
42
42
@@ -104,13 +104,13 @@ def test_simple(self):
104
104
schema = Schema ({"_id" : ObjectId , "data" : int64 (), "fake" : pa .float16 ()})
105
105
msg = 'Unsupported data type in schema for field "fake" of type "halffloat"'
106
106
with self .assertRaisesRegex (ValueError , msg ):
107
- PyMongoArrowContext . from_schema (schema )
107
+ PyMongoArrowContext (schema )
108
108
109
109
110
110
class TestNonAsciiFieldName (TestBsonToArrowConversionBase ):
111
111
def setUp (self ):
112
112
self .schema = Schema ({"_id" : ObjectIdType (), "dätá" : int64 ()})
113
- self .context = PyMongoArrowContext . from_schema (self .schema )
113
+ self .context = PyMongoArrowContext (self .schema )
114
114
115
115
def test_simple (self ):
116
116
ids = [ObjectId () for i in range (4 )]
@@ -150,7 +150,7 @@ def test_object_id_type(self):
150
150
class TestInt64Type (TestBsonToArrowConversionBase ):
151
151
def setUp (self ):
152
152
self .schema = Schema ({"data" : Int64 })
153
- self .context = PyMongoArrowContext . from_schema (self .schema )
153
+ self .context = PyMongoArrowContext (self .schema )
154
154
155
155
def test_simple (self ):
156
156
docs = [
@@ -165,7 +165,7 @@ def test_simple(self):
165
165
class TestBooleanType (TestBsonToArrowConversionBase ):
166
166
def setUp (self ):
167
167
self .schema = Schema ({"data" : bool })
168
- self .context = PyMongoArrowContext . from_schema (self .schema )
168
+ self .context = PyMongoArrowContext (self .schema )
169
169
170
170
def test_simple (self ):
171
171
docs = [
@@ -183,7 +183,7 @@ def test_simple(self):
183
183
class TestStringType (TestBsonToArrowConversionBase ):
184
184
def setUp (self ):
185
185
self .schema = Schema ({"data" : str })
186
- self .context = PyMongoArrowContext . from_schema (self .schema )
186
+ self .context = PyMongoArrowContext (self .schema )
187
187
188
188
def test_simple (self ):
189
189
docs = [
@@ -197,7 +197,7 @@ def test_simple(self):
197
197
class TestDecimal128Type (TestBsonToArrowConversionBase ):
198
198
def setUp (self ):
199
199
self .schema = Schema ({"data" : Decimal128 })
200
- self .context = PyMongoArrowContext . from_schema (self .schema )
200
+ self .context = PyMongoArrowContext (self .schema )
201
201
202
202
def test_simple (self ):
203
203
docs = [
@@ -212,7 +212,7 @@ def test_simple(self):
212
212
class TestSubdocumentType (TestBsonToArrowConversionBase ):
213
213
def setUp (self ):
214
214
self .schema = Schema ({"data" : dict (x = bool )})
215
- self .context = PyMongoArrowContext . from_schema (self .schema )
215
+ self .context = PyMongoArrowContext (self .schema )
216
216
217
217
def test_simple (self ):
218
218
docs = [
@@ -237,7 +237,7 @@ def test_simple(self):
237
237
238
238
def test_nested (self ):
239
239
self .schema = Schema ({"data" : dict (x = bool , y = dict (a = int ))})
240
- self .context = PyMongoArrowContext . from_schema (self .schema )
240
+ self .context = PyMongoArrowContext (self .schema )
241
241
242
242
docs = [
243
243
{"data" : dict (x = True , y = dict (a = 1 ))},
0 commit comments