

def test_result_stores_choosen_command(self):
    child = commands.Command()
    cmd = commands.Command()
    cmd.add_child('foo', child)
    result = cmd.parse(['foo'])
    self.assertEqual(result.command, child)
    result = cmd.parse([])
    self.assertEqual(result.command, cmd)
    child2 = commands.Command()
    cmd.add_child('bar', child2)
    subchild = commands.Command()
    child.add_child('baz', subchild)
    result = cmd.parse(['bar'])
    self.assertEqual(result.command, child2)
    result = cmd.parse(['foo', 'baz'])
    self.assertEqual(result.command, subchild)

dataset/ETHPy150Open mopidy/mopidy/tests/test_commands.py CommandParsingTest.test_result_stores_choosen_command/original