Exemple #1
0
        global failed_tests

        if result != correct:
            failed_tests += 1
            print(module_banner)
            print("test case failed, diff follows:")
            print(diff(correct, result))


    # Since this file is indented using spaces, let's indent our test
    # code using spaces too so it will compare right.
    set_indent_str("    ")

    # The default is to make time stamps using local time offset;
    # for the tests, we want a "GMT" offset default instead.
    set_default_time_offset("GMT")


    # Test: generate an RSS doc

    correct = """\
<rss version="2.0">
    <channel>
        <title>Silly Test of RSS</title>
        <link>http://www.example.com/rss.xml</link>
        <description>Use every RSS element at least once.</description>
        <language>en-us</language>
        <copyright>Copyright 2006 by Steve R. Hastings.</copyright>
        <managingEditor>[email protected]</managingEditor>
        <webMaster>[email protected]</webMaster>
        <pubDate>Tue, 21 Mar 2006 01:23:12 GMT</pubDate>
Exemple #2
0
        global failed_tests

        if result != correct:
            failed_tests += 1
            print(module_banner)
            print("test case failed, diff follows:")
            print(diff(correct, result))
            print()

    # Since this file is indented using spaces, let's indent our test
    # code using spaces too so it will compare right.
    set_indent_str("    ")

    # The default is to make time stamps using local time offset;
    # for the tests, we want a "GMT" offset default instead.
    set_default_time_offset("GMT")

    # Test: generate a trivial OPML doc
    #
    # http://www.atomenabled.org/developers/syndication/#sampleFeed

    correct = """\
<?xml version="1.0" encoding="utf-8"?>
<opml version="1.0">
    <head>
        <title>Silly test of OPML</title>
        <dateCreated>Mon, 20 Mar 2006 22:40:08 GMT</dateCreated>
        <dateModified>Tue, 21 Mar 2006 01:23:12 GMT</dateModified>
        <ownerName>J. Random Guy</ownerName>
        <ownerEmail>[email protected]</ownerEmail>
        <expansionState>1, 3, 4</expansionState>