

def test_parse_task_details(self):
    output = "Displaying detailed information for task 'test_env':\n\n    No docstring provided\n    Arguments: arg, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28, arg29, arg30\n\n"
    details = backend.parse_task_details('test_env', output)
    self.assertEqual(len(details), 3)
    self.assertEqual(details[0], 'test_env')
    self.assertEqual(details[1], None)
    self.assertListEqual(details[2], ['arg', 'arg2', 'arg3', 'arg4', 'arg5', 'arg6', 'arg7', 'arg8', 'arg9', 'arg10', 'arg11', 'arg12', 'arg13', 'arg14', 'arg15', 'arg16', 'arg17', 'arg18', 'arg19', 'arg20', 'arg21', 'arg22', 'arg23', 'arg24', 'arg25', 'arg26', 'arg27', 'arg28', 'arg29', 'arg30'])
    output = "Displaying detailed information for task 'do_nothing':\n\n    Awesome docstring\n    Arguments: test='default'\n\n"
    details = backend.parse_task_details('do_nothing', output)
    self.assertEqual(len(details), 3)
    self.assertEqual(details[0], 'do_nothing')
    self.assertEqual(details[1], 'Awesome docstring')
    self.assertEqual(len(details[2]), 1)
    self.assertIsInstance(details[2][0], tuple)
    self.assertTupleEqual(details[2][0], ('test', 'default'))
    output = "Displaying detailed information for task 'do_nothing':\n\n    Awesome docstring\n    Arguments: test='default', test2\n\n"
    details = backend.parse_task_details('do_nothing', output)
    self.assertEqual(len(details), 3)
    self.assertEqual(details[0], 'do_nothing')
    self.assertEqual(details[1], 'Awesome docstring')
    self.assertEqual(len(details[2]), 2)
    self.assertIsInstance(details[2][0], tuple)
    self.assertTupleEqual(details[2][0], ('test', 'default'))
    self.assertIsInstance(details[2][1], str)
    self.assertEqual(details[2][1], 'test2')
    output = "Displaying detailed information for task 's':\n\n    Set the Site that we're deploying or bootstrapping. For example s:production\n    :param site_alias:\n    :return:\n\n    Arguments: site_alias\n\n"
    details = backend.parse_task_details('s', output)
    self.assertEqual(len(details), 3)
    self.assertEqual(details[0], 's')
    self.assertEqual(details[1], "Set the Site that we're deploying or bootstrapping. For example s:production\n:param site_alias:\n:return:")
    self.assertEqual(len(details[2]), 1)
    self.assertIsInstance(details[2][0], str)
    self.assertEqual(details[2][0], 'site_alias')
    output = "Displaying detailed information for task 'deploy':\n\n    Pulls code, updates pip, syncs, migrates, collects static, resets permissions and reloads supervisor and nginx\n    :param hard:\n    :return:\n\n    Arguments: hard=False\n\n"
    details = backend.parse_task_details('deploy', output)
    self.assertEqual(len(details), 3)
    self.assertEqual(details[0], 'deploy')
    self.assertEqual(details[1], 'Pulls code, updates pip, syncs, migrates, collects static, resets permissions and reloads supervisor and nginx\n:param hard:\n:return:')
    self.assertEqual(len(details[2]), 1)
    self.assertIsInstance(details[2][0], str)
    self.assertEqual(details[2][0], 'hard')

dataset/ETHPy150Open fabric-bolt/fabric-bolt/fabric_bolt/task_runners/tests.py BackendTests.test_parse_task_details/original