-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Failure in __str__() before any output.
When calling str() on a spawn class object before it has any command output, the __str__() override attempts to truncate long command output while the value of self.before is still None, raising: TypeError: 'NoneType' object has no attribute '__getitem__'
- Loading branch information
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
""" Test __str__ methods. """ | ||
import pexpect | ||
|
||
from . import PexpectTestCase | ||
|
||
class TestCaseMisc(PexpectTestCase.PexpectTestCase): | ||
|
||
def test_str_spawnu(self): | ||
""" Exercise spawnu.__str__() """ | ||
# given, | ||
p = pexpect.spawnu('cat') | ||
# exercise, | ||
value = p.__str__() | ||
# verify | ||
assert isinstance(value, basestring) | ||
|
||
def test_str_spawn(self): | ||
""" Exercise spawn.__str__() """ | ||
# given, | ||
p = pexpect.spawn('cat') | ||
# exercise, | ||
value = p.__str__() | ||
# verify | ||
assert isinstance(value, basestring) | ||
|