Skip to content

Commit

Permalink
Feature: __add__ and __mul__ are implemented for stdout and stderr ob…
Browse files Browse the repository at this point in the history
…ject proxies
  • Loading branch information
pylover committed Jul 27, 2021
1 parent 0119e1f commit bec70f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bddcli/__init__.py
Expand Up @@ -2,4 +2,4 @@
from .authoring import given, when, story, status, stdout, stderr, Given
from .application import Application

__version__ = '2.7.0'
__version__ = '2.8.0'
6 changes: 6 additions & 0 deletions bddcli/proxy.py
Expand Up @@ -69,3 +69,9 @@ def __len__(self):

def __getitem__(self, key):
return self.proxied_object.__getitem__(key)

def __add__(self, other):
return self.proxied_object + other

def __mul__(self, other):
return self.proxied_object * other
3 changes: 2 additions & 1 deletion tests/test_proxy.py
Expand Up @@ -14,5 +14,6 @@ def test_proxy():
with Given(app, ['bar']):
assert stdout == 'foo bar\n'
assert len(stdout) == 8

assert stdout[:-1] == 'foo bar'
assert stdout + 'baz' == 'foo bar\nbaz'
assert stdout * 2 == 'foo bar\nfoo bar\n'

0 comments on commit bec70f7

Please sign in to comment.