Exemplo n.º 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)
Exemplo n.º 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.'))
Exemplo n.º 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.'))
Exemplo n.º 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)
Exemplo n.º 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.'))
Exemplo n.º 6
0
 def test_whitespace_is_stripped(self):
     self.assertEquals(
         'This is the subject.',
         subject_from_docstring('\nThis is the subject.\n'))
Exemplo n.º 7
0
 def test_one_line_only(self):
     self.assertEquals(
         'This is the subject.',
         subject_from_docstring('This is the subject.'))
Exemplo n.º 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.'))
Exemplo n.º 9
0
 def test_whitespace_is_stripped(self):
     self.assertEqual('This is the subject.',
                      subject_from_docstring('\nThis is the subject.\n'))
Exemplo n.º 10
0
 def test_one_line_only(self):
     self.assertEqual('This is the subject.',
                      subject_from_docstring('This is the subject.'))