From 265b7458cbb53e928bae0b5f49e94e8b5dc3e1e3 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 19 May 2011 22:11:18 -0500 Subject: [PATCH] in the common case, the and operation isn't needed --- _pytest/assertrewrite.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/_pytest/assertrewrite.py b/_pytest/assertrewrite.py index 3d847b648..f30e817d9 100644 --- a/_pytest/assertrewrite.py +++ b/_pytest/assertrewrite.py @@ -314,5 +314,8 @@ class AssertionRewriter(ast.NodeVisitor): ast.Tuple(load_names, ast.Load()), ast.Tuple(expls, ast.Load()), ast.Tuple(results, ast.Load())) - res = ast.BoolOp(ast.And(), load_names) + if len(comp.ops) > 1: + res = ast.BoolOp(ast.And(), load_names) + else: + res = load_names[0] return res, self.explanation_param(self.pop_format_context(expl_call))