= pyfo =

Generate XML using native python data structures

== License ==

Created and maintained by Luke Arno <luke.arno@gmail.com>

See documentation of pyfo method in this module for details.

Copyright (C) 2006  Central Piedmont Community College

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to:

The Free Software Foundation, Inc., 
51 Franklin Street, Fifth Floor, 
Boston, MA  02110-1301, USA.

Central Piedmont Community College
1325 East 7th St.
Charlotte, NC 28204, USA

Luke Arno can be found at http://lukearno.com/

== Adding Tests to This Package ==

This package uses simple rules based tests having three parts: a rule, 
test-input, and an output expectation. Pyfo is called with the 
test-input, with the argument specified in the rule, and if the result
matches the output expectation, the test passes. Additional test cases
can be added to pyfo_test.py in the usual way.

=== 1. Rules ===

Rules are found in the test_rules file in the following format:

[
    ('test_name',
     'input_file_name',
     ['list', 'of', 'args'],
     {'keyword':'args'},
     'ouput_expectation_file_name',
     "test error message"),
]

As you see, the rules are a python list. Each one is a tuple.

The test name must be valid as part of a Python method name.

Example:

[
    ('simple_html',
     'simple_html',
     [],
     {'pretty':True},
     'simple_html',
     "Should produce a very simple HTML Document"),
]



=== 2. Test Input ===

Test input is stored in files in the test-input directory. These files 
must contain 1 python expression which will be evaled and become the 
first argument to the pyfo method. Example:

('html', [('head', [('title', 'Example Test')],
          ('body', 
	   [('a', 'Luke Arno', {'href':'http://lukearno.com/'})])])

=== 3. Output Expectations ===

Expected output is stored in files in the expectations directory.
Example:

<html>
  <head>
    <title>Example Test</title>
  </head>
  <body>
    <a href="http://lukearno.com/">Luke Arno</a>
  </body>
</html>

