Skip to content

Commit 54ac068

Browse files
committed
add tests
1 parent 091f110 commit 54ac068

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/cpp/h5cpp/node/dataset.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ boost::python::object dataset_read(const hdf5::node::Dataset &self,
126126
Py_XINCREF(ptr);
127127

128128
boost::python::handle<> h(ptr);
129+
// CHECK
129130
data = boost::python::object(h);
130131
}
131132
}

test/h5cpp_tests/node_tests/dataset_io_test.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,21 @@ def testWriteVariableLengthUTF8Scalar(self):
131131
else:
132132
self.assertEqual(read, bdata)
133133

134+
def testWriteVariableLengthEmptyScalar(self):
135+
data = u""
136+
bdata = b""
137+
dtype = h5cpp.datatype.String.variable()
138+
# dtype.encoding = h5cpp.datatype.CharacterEncoding.UTF8
139+
dataset = Dataset(
140+
self.root, h5cpp.Path("VariableLengthStringEmptyScalar"),
141+
dtype, Scalar())
142+
# dataset.write(data)
143+
read = dataset.read()
144+
if sys.version_info > (3,):
145+
self.assertEqual(read, data)
146+
else:
147+
self.assertEqual(read, bdata)
148+
134149
def testWriteIntegerArray(self):
135150

136151
data = numpy.array([[1, 2, 3, 4], [5, 6, 7, 8]])

0 commit comments

Comments
 (0)