jenkins-bot submitted this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[tests] enable doctest for Revision

Change-Id: Idc6b7fd0a2564a94dc2a39e38a45252f904bbf15
---
M pywikibot/page/_revision.py
M tox.ini
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/pywikibot/page/_revision.py b/pywikibot/page/_revision.py
index efd8cef..5fb552f 100644
--- a/pywikibot/page/_revision.py
+++ b/pywikibot/page/_revision.py
@@ -7,6 +7,7 @@
import hashlib

from collections.abc import Mapping
+from contextlib import suppress

from pywikibot import Timestamp, warning
from pywikibot.tools import deprecated
@@ -23,7 +24,7 @@
>>> r.comment == r['comment']
True
>>> r.comment
- Sample for Revision access
+ 'Sample for Revision access'
"""

def __init__(self, **kwargs):
@@ -35,7 +36,8 @@
@staticmethod
def _upcast_dict(map_):
"""Upcast dictionary values."""
- map_['timestamp'] = Timestamp.fromISOformat(map_['timestamp'])
+ with suppress(KeyError): # enable doctest
+ map_['timestamp'] = Timestamp.fromISOformat(map_['timestamp'])

map_.update(anon='anon' in map_)
map_.update(minor='minor' in map_)
diff --git a/tox.ini b/tox.ini
index 13cc35a..a9b7962 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,7 +8,7 @@
flake8-{py35,py36}

[params]
-doctest_skip = --ignore-files=(_revision|eventstreams|gui|mysql)\.py
+doctest_skip = --ignore-files=(eventstreams|gui|mysql)\.py
generate_user_files = -W error::UserWarning -m generate_user_files -family:wikipedia -lang:test -v

[testenv]

To view, visit change 676283. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Idc6b7fd0a2564a94dc2a39e38a45252f904bbf15
Gerrit-Change-Number: 676283
Gerrit-PatchSet: 6
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged