~cjwatson/lazr.restful/py3-html-escape

« back to all changes in this revision

Viewing changes to src/lazr/restful/docs/webservice-declarations.rst

  • Committer: Colin Watson
  • Date: 2020-09-07 12:19:45 UTC
  • mfrom: (265.4.1 py3-doctest-print)
  • Revision ID: cjwatson@canonical.com-20200907121945-16hq299dvhy8dmxq
[r=ilasc] Convert doctests to use print() for Unicode strings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
512
512
 
513
513
    >>> param_defs['optional1'].required
514
514
    False
515
 
    >>> param_defs['optional1'].default
516
 
    u'Default'
 
515
    >>> print(param_defs['optional1'].default)
 
516
    Default
517
517
 
518
518
And optional2 was exported with the same default than the method:
519
519
 
520
520
    >>> param_defs['optional2'].required
521
521
    False
522
 
    >>> param_defs['optional2'].default
523
 
    u'Default2'
 
522
    >>> print(param_defs['optional2'].default)
 
523
    Default2
524
524
 
525
525
Error handling
526
526
--------------
1011
1011
    True
1012
1012
    >>> verifyObject(entry_interface, entry_adapter)
1013
1013
    True
1014
 
    >>> entry_adapter.author
1015
 
    u'Aldous Huxley'
 
1014
    >>> print(entry_adapter.author)
 
1015
    Aldous Huxley
1016
1016
    >>> entry_adapter.price
1017
1017
    10.0
1018
 
    >>> entry_adapter.title
1019
 
    u'Island'
 
1018
    >>> print(entry_adapter.title)
 
1019
    Island
1020
1020
 
1021
1021
It's an error to call this function on an interface not exported on the
1022
1022
web service:
1292
1292
    >>> endInteraction()
1293
1293
    >>> newInteraction(factory_method_adapter.request)
1294
1294
 
1295
 
    >>> factory_method_adapter.call(
1296
 
    ...     author='Aldous Huxley', title="Eyeless in Gaza", price=10.5)
1297
 
    u''
 
1295
    >>> print(factory_method_adapter.call(
 
1296
    ...     author='Aldous Huxley', title="Eyeless in Gaza", price=10.5))
 
1297
    <BLANKLINE>
1298
1298
    >>> response = factory_method_adapter.request.response
1299
1299
    >>> response.status
1300
1300
    201
2621
2621
 
2622
2622
(Clean-up.)
2623
2623
 
2624
 
    >>> import sys
2625
2624
    >>> del bookexample
2626
2625
    >>> del sys.modules['lazr.restful.bookexample']
2627
2626