示例#1
0
 def _find_upgrade_step_classes_in_module(self, module):
     for name, value in inspect.getmembers(module, inspect.isclass):
         if value == UpgradeStep or not issubclass(value, UpgradeStep):
             continue
         title = subject_from_docstring(inspect.getdoc(value) or name)
         title = six.ensure_text(title)
         yield (title, value)
示例#2
0
 def test_multiline_subject_is_joined(self):
     self.assertEqual(
         'This is a subject, with multiple lines.',
         subject_from_docstring('This is a subject,\n'
                                'with multiple lines.\n'
                                '\n'
                                'And the body.'))
示例#3
0
 def test_multiline_subject_is_joined(self):
     self.assertEquals(
         'This is a subject, with multiple lines.',
         subject_from_docstring('This is a subject,\n'
                                'with multiple lines.\n'
                                '\n'
                                'And the body.'))
示例#4
0
    def _find_upgrade_step_classes_in_module(self, module):
        for name, value in inspect.getmembers(module, inspect.isclass):
            if not issubclass(value, UpgradeStep):
                continue

            if inspect.getmodule(value) is not module:
                continue

            title = subject_from_docstring(inspect.getdoc(value) or name)
            if isinstance(title, str):
                title = title.decode('utf-8')
            yield (title, value)
示例#5
0
 def test_only_subject_is_returned(self):
     self.assertEquals(
         'This is the subject.',
         subject_from_docstring('This is the subject.\n\nThis is the body.'))
示例#6
0
 def test_whitespace_is_stripped(self):
     self.assertEquals(
         'This is the subject.',
         subject_from_docstring('\nThis is the subject.\n'))
示例#7
0
 def test_one_line_only(self):
     self.assertEquals(
         'This is the subject.',
         subject_from_docstring('This is the subject.'))
示例#8
0
 def test_only_subject_is_returned(self):
     self.assertEqual(
         'This is the subject.',
         subject_from_docstring(
             'This is the subject.\n\nThis is the body.'))
示例#9
0
 def test_whitespace_is_stripped(self):
     self.assertEqual('This is the subject.',
                      subject_from_docstring('\nThis is the subject.\n'))
示例#10
0
 def test_one_line_only(self):
     self.assertEqual('This is the subject.',
                      subject_from_docstring('This is the subject.'))