Skip to content

Commit e32b560

Browse files
authored
ARROW-27 Test non-ASCII UTF-8 keys schema field names (#48)
1 parent 3239d3b commit e32b560

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

bindings/python/test/test_bson.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,32 @@ def test_simple(self):
103103
class TestUnsupportedDataType(TestBsonToArrowConversionBase):
104104

105105
def test_simple(self):
106-
107106
schema = Schema({'_id': ObjectId,
108107
'data': int64(),
109108
'fake': pyarrow.float16() })
110109
msg = ("Unsupported data type in schema for field " +
111110
'"fake" of type "halffloat"')
112111
with self.assertRaisesRegex(ValueError, msg):
113112
PyMongoArrowContext.from_schema(schema)
113+
114+
115+
class TestNonAsciiFieldName(TestBsonToArrowConversionBase):
116+
117+
def setUp(self):
118+
self.schema = Schema({'_id': ObjectId,
119+
'dätá': int64()})
120+
self.context = PyMongoArrowContext.from_schema(
121+
self.schema)
122+
123+
def test_simple(self):
124+
ids = [ObjectId() for i in range(4)]
125+
docs = [{'_id': ids[0], 'dätá': 10 },
126+
{'_id': ids[1], 'dätá': 20 },
127+
{'_id': ids[2], 'dätá': 30 },
128+
{'_id': ids[3], 'dätá': 40 }]
129+
as_dict = {
130+
'_id': [oid.binary for oid in ids] ,
131+
'dätá': [10, 20, 30, 40]
132+
}
133+
134+
self._run_test(docs, as_dict)

0 commit comments

Comments
 (0)