From a504544d0fe6637e078497086ef2acbdce0a2a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Sanz?= Date: Fri, 8 Jan 2016 15:43:51 +0100 Subject: [PATCH] ExampleGroup: refactor to guard clause --- mamba/example_group.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mamba/example_group.py b/mamba/example_group.py index dbd8107..bf3ab0a 100644 --- a/mamba/example_group.py +++ b/mamba/example_group.py @@ -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()