Rev 2459: Add a get_help_topic method to RegisteredTopic. in file:///home/robertc/source/baz/help-contexts/

Robert Collins robertc at robertcollins.net
Fri Apr 20 06:37:01 BST 2007


At file:///home/robertc/source/baz/help-contexts/

------------------------------------------------------------
revno: 2459
revision-id: robertc at robertcollins.net-20070420053658-gpwvs7wkmivmlzlx
parent: robertc at robertcollins.net-20070420053228-wp4tmjr15vxbis24
committer: Robert Collins <robertc at robertcollins.net>
branch nick: help-contexts
timestamp: Fri 2007-04-20 15:36:58 +1000
message:
  Add a get_help_topic method to RegisteredTopic.
modified:
  bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
  bzrlib/tests/test_help.py      test_help.py-20070419045354-6q6rq15j9e2n5fna-1
=== modified file 'bzrlib/help_topics.py'
--- a/bzrlib/help_topics.py	2007-04-20 05:30:47 +0000
+++ b/bzrlib/help_topics.py	2007-04-20 05:36:58 +0000
@@ -298,3 +298,7 @@
             result += ', '.join(see_also)
             result += '\n'
         return result
+
+    def get_help_topic(self):
+        """Return the help topic this can be found under."""
+        return self.topic

=== modified file 'bzrlib/tests/test_help.py'
--- a/bzrlib/tests/test_help.py	2007-04-20 04:36:09 +0000
+++ b/bzrlib/tests/test_help.py	2007-04-20 05:36:58 +0000
@@ -100,6 +100,13 @@
             '\n'
             'See also: bar, foo\n')
 
+    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())
+
 
 class TestTopicIndex(tests.TestCase):
     """Tests for the HelpTopicIndex class."""



More information about the bazaar-commits mailing list