OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 ''' |
| 3 PEXPECT LICENSE |
| 4 |
| 5 This license is approved by the OSI and FSF as GPL-compatible. |
| 6 http://opensource.org/licenses/isc-license.txt |
| 7 |
| 8 Copyright (c) 2012, Noah Spurrier <noah@noah.org> |
| 9 PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY |
| 10 PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE |
| 11 COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES. |
| 12 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 13 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 14 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 15 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 19 |
| 20 ''' |
| 21 import pexpect |
| 22 import unittest |
| 23 from . import PexpectTestCase |
| 24 |
| 25 class TestCaseConstructor(PexpectTestCase.PexpectTestCase): |
| 26 def test_constructor (self): |
| 27 '''This tests that the constructor will work and give |
| 28 the same results for different styles of invoking __init__(). |
| 29 This assumes that the root directory / is static during the test. |
| 30 ''' |
| 31 p1 = pexpect.spawn('uname -m -n -p -r -s -v') |
| 32 p2 = pexpect.spawn('uname', ['-m', '-n', '-p', '-r', '-s', '-v']) |
| 33 p1.expect(pexpect.EOF) |
| 34 p2.expect(pexpect.EOF) |
| 35 assert p1.before == p2.before |
| 36 |
| 37 def test_named_parameters (self): |
| 38 '''This tests that named parameters work. |
| 39 ''' |
| 40 p = pexpect.spawn ('/bin/ls',timeout=10) |
| 41 p = pexpect.spawn (timeout=10, command='/bin/ls') |
| 42 p = pexpect.spawn (args=[], command='/bin/ls') |
| 43 |
| 44 if __name__ == '__main__': |
| 45 unittest.main() |
| 46 |
| 47 suite = unittest.makeSuite(TestCaseConstructor,'test') |
| 48 |
OLD | NEW |