def test_accumulateAdditionalOptions(self): """ Test that we pick up options that are only defined by having an appropriately named method on your Options class, e.g. def opt_foo(self, foo) """ opts = TestOptions2() ag = zshcomp.ArgumentsGenerator('dummy_cmd', opts, 'dummy_value') self.failUnless('nocrash' in ag.optFlags_d and \ 'nocrash' in ag.optAll_d) self.failUnless('difficulty' in ag.optParams_d and \ 'difficulty' in ag.optAll_d)
def test_accumulateAdditionalOptions(self): """ We pick up options that are only defined by having an appropriately named method on your Options class, e.g. def opt_foo(self, foo) """ opts = FighterAceExtendedOptions() ag = zshcomp.ArgumentsGenerator('dummy_cmd', opts, 'dummy_value') self.assertIn('nocrash', ag.optFlags_d) self.assertIn('nocrash', ag.optAll_d) self.assertIn('difficulty', ag.optParams_d) self.assertIn('difficulty', ag.optAll_d)
def test_accumulateMetadata(self): """ Test that the zsh_* variables you can place on Option classes gets picked up correctly """ opts = TestOptions2() ag = zshcomp.ArgumentsGenerator('dummy_cmd', opts, 'dummy_value') altArgDescr = TestOptions.zsh_altArgDescr.copy() altArgDescr.update(TestOptions2.zsh_altArgDescr) actionDescr = TestOptions.zsh_actionDescr.copy() actionDescr.update(TestOptions2.zsh_actionDescr) self.failUnlessEquals(ag.altArgDescr, altArgDescr) self.failUnlessEquals(ag.actionDescr, actionDescr) self.failUnlessEquals(ag.multiUse, TestOptions.zsh_multiUse) self.failUnlessEquals(ag.mutuallyExclusive, TestOptions.zsh_mutuallyExclusive) self.failUnlessEquals(ag.actions, TestOptions.zsh_actions) self.failUnlessEquals(ag.extras, TestOptions.zsh_extras)
def test_accumulateMetadata(self): """ The zsh_* variables you can place on Options classes are picked up correctly? """ opts = FighterAceExtendedOptions() ag = zshcomp.ArgumentsGenerator('dummy_cmd', opts, 'dummy_value') altArgDescr = FighterAceOptions.zsh_altArgDescr.copy() altArgDescr.update(FighterAceExtendedOptions.zsh_altArgDescr) actionDescr = FighterAceOptions.zsh_actionDescr.copy() actionDescr.update(FighterAceExtendedOptions.zsh_actionDescr) self.assertEqual(ag.altArgDescr, altArgDescr) self.assertEqual(ag.actionDescr, actionDescr) self.assertEqual(ag.multiUse, FighterAceOptions.zsh_multiUse) self.assertEqual(ag.mutuallyExclusive, FighterAceOptions.zsh_mutuallyExclusive) self.assertEqual(ag.actions, FighterAceOptions.zsh_actions) self.assertEqual(ag.extras, FighterAceOptions.zsh_extras)