mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +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):
|
class Writable(StringIO):
|
||||||
def __init__(self):
|
def __init__(self, data=None):
|
||||||
StringIO.__init__(self)
|
if data:
|
||||||
|
StringIO.__init__(self, data)
|
||||||
|
else:
|
||||||
|
StringIO.__init__(self)
|
||||||
self.data = []
|
self.data = []
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||||
@ -70,9 +73,6 @@ class Writable(StringIO):
|
|||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def read(self, n=-1):
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def write(self, s):
|
def write(self, s):
|
||||||
self.data.append(s)
|
self.data.append(s)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user