Skip to content

Commit

Permalink
ExampleGroup: refactor to guard clause
Browse files Browse the repository at this point in the history
  • Loading branch information
Ángel Sanz committed Apr 2, 2016
1 parent ee10dd9 commit 15ff01e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mamba/example_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ def _start(self, reporter):
reporter.example_group_started(self)

def _register_subject_creation_in_before_each_hook(self):
if self._can_create_subject():
self._hooks['before_each'].insert(0, lambda execution_context: self._create_subject(execution_context))
if not self._can_create_subject():
return

self._hooks['before_each'].insert(0, lambda execution_context: self._create_subject(execution_context))

def _can_create_subject(self):
return self._subject_is_class()
Expand Down

0 comments on commit 15ff01e

Please sign in to comment.