def test_header_output(self):
"""Output a header for a ring explicitly"""
def generate_array_and_header():
"""Output the desired header of an array"""
header = {'dtype': 'complex128', 'nbit': 128}
yield np.array([1, 2, 3, 4]), header
def assert_expectation(array):
"Assert that the array has a complex datatype"
np.testing.assert_almost_equal(array, [1, 2, 3, 4])
self.assertEqual(array.dtype, np.dtype('complex128'))
self.occurences += 1
blocks = []
blocks.append((
NumpySourceBlock(generate_array_and_header, grab_headers=True),
{'out_1': 0}))
blocks.append((NumpyBlock(assert_expectation, outputs=0), {'in_1': 0}))
Pipeline(blocks).main()
self.assertEqual(self.occurences, 1)
评论列表
文章目录