Skip to content

Commit

Permalink
Fix a couple doctests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yonran committed Oct 10, 2023
1 parent f395263 commit d92251d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
8 changes: 7 additions & 1 deletion remoteobjects/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,17 @@ class Link(AcceptsStringCls, Property):
For example:
>>> from remoteobjects import RemoteObject
>>> from remoteobjects.fields import Link
>>> class Event(RemoteObject): pass
...
>>> class Item(RemoteObject):
... feed = Link(Event)
...
>>> i = Item.get('http://example.com/item/')
>>> f = i.feed # f's URL: http://example.com/item/feed
>>> f = i.feed
>>> f._location
'http://example.com/item/feed'
Override the `__get__` method of a `Link` subclass to customize how the
URLs to linked objects are constructed.
Expand Down
7 changes: 7 additions & 0 deletions remoteobjects/listobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ class PageOf(with_metaclass(OfOf, type(PromiseObject))):
new `PageObject` classes that contain objects of a specified other class,
like so:
>>> from remoteobjects import RemoteObject
>>> from remoteobjects.listobject import PageObject, PageOf
>>> class Entry(RemoteObject): pass
...
>>> PageOfEntry = PageOf(Entry)
This is equivalent to defining ``PageOfEntry`` yourself:
Expand Down Expand Up @@ -167,6 +171,9 @@ class PageObject(with_metaclass(PageOf, SequenceProxy, PromiseObject)):
`PageOf`, with the class reference you would use to construct an `Object`
field. That is, these declarations are equivalent:
>>> from remoteobjects import fields, RemoteObject
>>> from remoteobjects.listobject import PageObject, PageOf
>>> class Entry(RemoteObject): pass
>>> PageOfEntry = PageOf(Entry)
>>> class PageOfEntry(PageObject):
Expand Down

0 comments on commit d92251d

Please sign in to comment.