Next / Previous / Contents / Shipman's homepage

22.2. identitest: Round-trip test script

This script attempts to read the 2999-01.xml example file described in Section 22.1, “Sample XML input file” and, if successful, write it back out as XML to its standard output stream. The output file should be hand-checked against the input to make sure everything is still there.

identitest
#!/usr/bin/env python
#================================================================
# identitest:  Round-trip test for 2999-01.xml
#   For documentation, see:
#     http://www.nmt.edu/~shipman/aba/doc/pyims/
#----------------------------------------------------------------

import sys
import txny
from birdnotes import *

# - - - - -   m a i n

def main():
    """
    """
    # [ t  :=  a txny.Txny object representing file "aou.xml" ]
    t = txny.Txny()

    # [ noteSet  :=  a new, empty BirdNoteSet instance using txny
    #                for classification ]
    noteSet = BirdNoteSet(t)

    # [ noteSet  :=  a BirdNoteSet instance representing file
    #                "2999-01.xml" ]
    noteSet.readFile("2999-01.xml")

    # [ sys.stdout  +:=  XML representing noteSet ]
    noteSet.writeFile(sys.stdout)


#================================================================
# Epilogue
#----------------------------------------------------------------

if __name__ == "__main__":
    main()