Exemplo n.º 1
0
 def test_add_array_with_bad_name(self):
     data_array = DataArray('this is not a good name',
                            'label',
                            preset_data=np.array([1, 2, 3, 4, 5]))
     data_set = DataSet()
     with self.assertRaisesRegex(
             SyntaxError,
             "'this is not a good name' is an invalid name for an identifier."
     ):
         data_set.add_array(data_array)
     data_array.name = 99
     with self.assertRaisesRegex(
             ValueError, "Array name has to be string, not <class 'int'>"):
         data_set.add_array(data_array)
Exemplo n.º 2
0
    def test_properties(self):
        data_array = DataArray(name='x',
                               label='x-axis',
                               unit='mV',
                               shape=(5, 5))
        self.assertEqual('x', data_array.name)
        self.assertEqual('x-axis', data_array.label)
        self.assertEqual('mV', data_array.unit)

        data_array.name = 'y'
        self.assertEqual('y', data_array.name)
        data_array.label = 'y-axis'
        self.assertEqual('y-axis', data_array.label)
        data_array.unit = 'Hz'
        self.assertEqual('Hz', data_array.unit)