MCPcopy Create free account
hub / github.com/Exiv2/exiv2 / Output

Class Output

tests/bash_tests/utils.py:530–564  ·  view source on GitHub ↗

Simulate the stdout buffer. You can use `out+=x` to simulate `print(x)` Sample: >>> out = Output() >>> out >>> str(out) >>> out += 'Hello' >>> out += 1 >>> out += ['Hi' , 2] >>> out += None # no effect >>> str(out)

Source from the content-addressed store, hash-verified

528
529
530class Output:
531 """
532 Simulate the stdout buffer.
533 You can use `out+=x` to simulate `print(x)`
534
535 Sample:
536 >>> out = Output()
537 >>> out
538 >>> str(out)
539 >>> out += 'Hello'
540 >>> out += 1
541 >>> out += ['Hi' , 2]
542 >>> out += None # no effect
543 >>> str(out)
544 """
545 def __init__(self):
546 self.lines = []
547 self.newline = '\n'
548
549 def __str__(self):
550 return self.newline.join(self.lines)
551
552 # Comment it so that log does not automatically convert to str type
553 # def __repr__(self):
554 # return str(self)
555
556 def __add__(self, other):
557 if isinstance(other, Executer):
558 other = other.stdout
559 if other != None:
560 self.lines.append(str(other))
561 return self
562
563 def __radd__(self, other):
564 return self.__add__(other)
565
566
567def reportTest(testname, output: str, encoding=None,forgive=False):

Callers 1

runTestCaseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected