pytty

changeset 19:69b68fa5f779

Adding doctests
author Arc Riley <arcriley@gmail.com>
date Tue, 13 Dec 2011 15:30:06 -0500
parents 27c8ec364325
children 0b78538ec01b
files tests/TestDocs.py
diffstat 1 files changed, 45 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tests/TestDocs.py	Tue Dec 13 15:30:06 2011 -0500
     1.3 @@ -0,0 +1,45 @@
     1.4 +#!/usr/bin/env python
     1.5 +# -*- coding: utf-8 -*-
     1.6 +
     1.7 +'''TestDocs for PyTTY
     1.8 +
     1.9 +    This test suite scans PyTTY's documentation for code examples and runs
    1.10 +    them checking to ensure the output is as expected.
    1.11 +
    1.12 +    See http://docs.python.org/library/doctest.html for details.
    1.13 +'''
    1.14 +
    1.15 +__credits__ = '''Copyright (C) 2010,2011 Arc Riley
    1.16 +
    1.17 +    This program is free software; you can redistribute it and/or modify
    1.18 +    it under the terms of the GNU Lesser General Public License as published
    1.19 +    by the Free Software Foundation, either version 3 of the License, or
    1.20 +    (at your option) any later version.
    1.21 +
    1.22 +    This program is distributed in the hope that it will be useful,
    1.23 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.24 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.25 +    GNU Lesser General Public License for more details.
    1.26 +
    1.27 +    You should have received a copy of the GNU Lesser General Public License
    1.28 +    along with this program; if not, see http://www.gnu.org/licenses
    1.29 +'''
    1.30 +
    1.31 +
    1.32 +import doctest
    1.33 +import unittest2 as unittest
    1.34 +import pytty
    1.35 +
    1.36 +
    1.37 +def load_tests(loader, tests, ignore):
    1.38 +    tests.addTests(doctest.DocTestSuite(
    1.39 +        module = pytty,
    1.40 +        globs = {
    1.41 +            'soy' : pytty,  # So examples don't need "import pytty"
    1.42 +        },
    1.43 +    ))
    1.44 +    return tests
    1.45 +
    1.46 +
    1.47 +if __name__ == '__main__':
    1.48 +    unittest.main()