mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Accept content in Writer
This commit is contained in:
parent
c4c2ac7e70
commit
bc1a8b7e45
@ -60,8 +60,11 @@ def mock_open(data=None):
|
||||
|
||||
|
||||
class Writable(StringIO):
|
||||
def __init__(self):
|
||||
StringIO.__init__(self)
|
||||
def __init__(self, data=None):
|
||||
if data:
|
||||
StringIO.__init__(self, data)
|
||||
else:
|
||||
StringIO.__init__(self)
|
||||
self.data = []
|
||||
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
@ -70,9 +73,6 @@ class Writable(StringIO):
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def read(self, n=-1):
|
||||
return ""
|
||||
|
||||
def write(self, s):
|
||||
self.data.append(s)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user