コード例 #1
0
def test_simple():
    """Simple dictionary."""
    s = dumps({'foo': 'bar', 'baz': 'bar'}, 'response')
    print s
    assert s.startswith('<response>')
    assert '<foo>bar</foo>' in s
    assert '<baz>bar</baz>' in s
    assert s.endswith('</response>')
コード例 #2
0
def test_serialisation_unicode():
    """Unicode strings are converted to UTF-8."""
    s = dumps({'test': u'gfröhrli'}, 'response')
    print s
    assert s == '<response><test>gfröhrli</test></response>'
コード例 #3
0
def test_serialisation_bool():
    """XML serialization uses the lower-case string value for booleans."""
    s = dumps(True, 'response')
    print s
    assert s == '<response>true</response>'