mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge branch '1.8'
This commit is contained in:
commit
aabbbe346c
1
CHANGES
1
CHANGES
@ -232,6 +232,7 @@ Bugs fixed
|
|||||||
* #5960: LaTeX: modified PDF layout since September 2018 TeXLive update of
|
* #5960: LaTeX: modified PDF layout since September 2018 TeXLive update of
|
||||||
:file:`parskip.sty`
|
:file:`parskip.sty`
|
||||||
* #5958: versionadded directive causes crash with Python 3.5.0
|
* #5958: versionadded directive causes crash with Python 3.5.0
|
||||||
|
* #5995: autodoc: autodoc_mock_imports conflict with metaclass on Python 3.7
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
--------
|
--------
|
||||||
|
@ -58,7 +58,7 @@ class _MockObject:
|
|||||||
|
|
||||||
def __mro_entries__(self, bases):
|
def __mro_entries__(self, bases):
|
||||||
# type: (Tuple) -> Tuple
|
# type: (Tuple) -> Tuple
|
||||||
return bases
|
return (self.__class__,)
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
# type: (str) -> _MockObject
|
# type: (str) -> _MockObject
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
:license: BSD, see LICENSE for details.
|
:license: BSD, see LICENSE for details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import abc
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -60,3 +61,21 @@ def test_mock_does_not_follow_upper_modules():
|
|||||||
with mock(['sphinx.unknown.module']):
|
with mock(['sphinx.unknown.module']):
|
||||||
with pytest.raises(ImportError):
|
with pytest.raises(ImportError):
|
||||||
__import__('sphinx.unknown')
|
__import__('sphinx.unknown')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(sys.version_info < (3, 7), reason='Only for py37 or above')
|
||||||
|
def test_abc_MockObject():
|
||||||
|
mock = _MockObject()
|
||||||
|
|
||||||
|
class Base:
|
||||||
|
@abc.abstractmethod
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Derived(Base, mock.SubClass):
|
||||||
|
pass
|
||||||
|
|
||||||
|
obj = Derived()
|
||||||
|
assert isinstance(obj, Base)
|
||||||
|
assert isinstance(obj, _MockObject)
|
||||||
|
assert isinstance(obj.some_method(), Derived)
|
||||||
|
Loading…
Reference in New Issue
Block a user