def test_get_help_topic(self): """The help topic for a RegisteredTopic is its topic from construction.""" topic = help_topics.RegisteredTopic('foobar') self.assertEqual('foobar', topic.get_help_topic()) topic = help_topics.RegisteredTopic('baz') self.assertEqual('baz', topic.get_help_topic())
def test_get_help_text_loaded_from_file(self): # Pick a known topic stored in an external file topic = help_topics.RegisteredTopic('hooks') self.assertStartsWith(topic.get_help_text(), 'Hooks\n' '=====\n' '\n')
def test_get_help_text(self): """A RegisteredTopic returns the get_detail results for get_help_text.""" topic = help_topics.RegisteredTopic('commands') self.assertEqual(help_topics.topic_registry.get_detail('commands'), topic.get_help_text())
def test_get_help_text_with_additional_see_also(self): topic = help_topics.RegisteredTopic('commands') self.assertEndsWith(topic.get_help_text(['foo', 'bar']), '\n' 'See also: bar, foo\n')
def test_contruct(self): """Construction takes the help topic name for the registered item.""" # validate our test self.assertTrue('basic' in help_topics.topic_registry) topic = help_topics.RegisteredTopic('basic') self.assertEqual('basic', topic.topic)