def test_sge_tasks_valid(self): """Check the _SGETasks class with valid input""" t = _SGETasks('-t 27') self.assertEqual((t.first, t.last, t.step), (27, 27, 1)) t = _SGETasks('-t 4-10') self.assertEqual((t.first, t.last, t.step), (4, 10, 1)) t = _SGETasks('-t 4-10:2') self.assertEqual((t.first, t.last, t.step), (4, 10, 2))
def test_sge_tasks_run_get(self): """Check the _SGETasks.get_run_id() method""" t = _SGETasks('-t 4-10:2') self.assertEqual(t.get_run_id(['foo.4', 'foo.6', 'foo.8', 'foo.10']), 'foo.4-10:2') t = _SGETasks('-t 1-3') self.assertEqual(t.get_run_id(['foo.1', 'foo.2', 'foo.3']), 'foo.1-3:1') t = _SGETasks('-t 4-10:2') self.assertRaises(ValueError, t.get_run_id, ['foo.1', 'foo.2', 'foo.3'])
def test_sge_tasks_none(self): """Check the _SGETasks class with no subtasks""" for s in ('', '-o foo -p bar'): t = _SGETasks(s) self.assert_(not t)