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