def test_setup_task_invalid_channel(self): device = "cDAQ3Mod1" channels = ["ai9"] clock_rate = 2000 with self.assertRaises(Exception): retrieveData.setup_task(device, channels, clock_rate)
def test_setup_task_invalid_device(self): device = "fake_name" channels = ["ai0"] clock_rate = 2000 with self.assertRaises(Exception): retrieveData.setup_task(device, channels, clock_rate)
def test_setup_task_clock_0(self): device = "cDAQ3Mod1" channels = ["ai0"] clock_rate = 0 with self.assertRaises(Exception): retrieveData.setup_task(device, channels, clock_rate)
def test_setup_task_channels_not_in_list(self): device = "cDAQ3Mod1" channels = "ai0" clock_rate = 2000 with self.assertRaises(Exception): retrieveData.setup_task(device, channels, clock_rate)
def test_setup_task_valid_with_1(self): device = "cDAQ3Mod1" channels = ["ai0"] clock_rate = 2000 task = retrieveData.setup_task(device, channels, clock_rate) self.assertTrue(isinstance(task, nidaqmx.Task)) self.assertEqual(task.number_of_channels, 1) self.assertTrue("cDAQ3Mod1/ai0" in task.ai_channels.channel_names) task.close()