

def test_nested_usage(self):
    child = commands.Command()
    cmd = commands.Command()
    cmd.add_child('bar', child)
    self.assertEqual('usage: foo', cmd.format_usage('foo').strip())
    self.assertEqual('usage: foo bar', cmd.format_usage('foo bar').strip())
    cmd.add_argument('-h', '--help', action='store_true')
    self.assertEqual('usage: foo bar', child.format_usage('foo bar').strip())
    child.add_argument('-h', '--help', action='store_true')
    self.assertEqual('usage: foo bar [-h]', child.format_usage('foo bar').strip())

dataset/ETHPy150Open mopidy/mopidy/tests/test_commands.py UsageTest.test_nested_usage/original