diff --git a/.gitignore b/.gitignore index de25a6f76..0c69e42d1 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /docs/.build/ /*.egg-info *.pyc +*.pyo _scratch/ Session.vim /.tox/ diff --git a/.travis.yml b/.travis.yml index 3345ff24f..0db6b1167 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: python python: + - "3.5" - "3.4" - "3.3" - "2.7" @@ -7,4 +8,14 @@ python: # command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors install: pip install -r requirements.txt # command to run tests, e.g. python setup.py test -script: py.test +script: py.test + +# run python -OO on certain versions only, 3.3 and 3.5 cannot handle this +matrix: + include: + - python: "2.6" + script: python -OO -m py.test tests/test_enum.py + - python: "2.7" + script: python -OO -m py.test tests/test_enum.py + - python: "3.4" + script: python -OO -m py.test tests/test_enum.py diff --git a/docx/enum/base.py b/docx/enum/base.py index aad44e9c8..823496250 100644 --- a/docx/enum/base.py +++ b/docx/enum/base.py @@ -60,6 +60,8 @@ def _intro_text(self): cls_docstring = self._clsdict['__doc__'] except KeyError: cls_docstring = '' + if None == cls_docstring: + cls_docstring = '' return textwrap.dedent(cls_docstring).strip() def _member_def(self, member): diff --git a/tests/test_enum.py b/tests/test_enum.py index edfe595dc..bc3e12c47 100644 --- a/tests/test_enum.py +++ b/tests/test_enum.py @@ -77,6 +77,9 @@ def it_knows_if_a_setting_is_valid(self): def it_can_be_referred_to_by_a_convenience_alias_if_defined(self): assert BARFOO is FOOBAR # noqa + def it_provides_doc(self): + assert(FOOBAR.__docs_rst__) + class DescribeEnumValue(object):