Skip to content

Commit d92251d

Browse files
committed
Fix a couple doctests
I still don’t run doctest though since python -m doctest fails on python3 (No module named 'http.client'; 'http' is not a package ) and there are doctest errors in other files.
1 parent f395263 commit d92251d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

remoteobjects/fields.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,11 +437,17 @@ class Link(AcceptsStringCls, Property):
437437
438438
For example:
439439
440+
>>> from remoteobjects import RemoteObject
441+
>>> from remoteobjects.fields import Link
442+
>>> class Event(RemoteObject): pass
443+
...
440444
>>> class Item(RemoteObject):
441445
... feed = Link(Event)
442446
...
443447
>>> i = Item.get('http://example.com/item/')
444-
>>> f = i.feed # f's URL: http://example.com/item/feed
448+
>>> f = i.feed
449+
>>> f._location
450+
'http://example.com/item/feed'
445451
446452
Override the `__get__` method of a `Link` subclass to customize how the
447453
URLs to linked objects are constructed.

remoteobjects/listobject.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ class PageOf(with_metaclass(OfOf, type(PromiseObject))):
8888
new `PageObject` classes that contain objects of a specified other class,
8989
like so:
9090
91+
>>> from remoteobjects import RemoteObject
92+
>>> from remoteobjects.listobject import PageObject, PageOf
93+
>>> class Entry(RemoteObject): pass
94+
...
9195
>>> PageOfEntry = PageOf(Entry)
9296
9397
This is equivalent to defining ``PageOfEntry`` yourself:
@@ -167,6 +171,9 @@ class PageObject(with_metaclass(PageOf, SequenceProxy, PromiseObject)):
167171
`PageOf`, with the class reference you would use to construct an `Object`
168172
field. That is, these declarations are equivalent:
169173
174+
>>> from remoteobjects import fields, RemoteObject
175+
>>> from remoteobjects.listobject import PageObject, PageOf
176+
>>> class Entry(RemoteObject): pass
170177
>>> PageOfEntry = PageOf(Entry)
171178
172179
>>> class PageOfEntry(PageObject):

0 commit comments

Comments
 (0)