From 9859c110cc9851a25802524f09fc58ce2aa018db Mon Sep 17 00:00:00 2001 From: Tushar Sadhwani <86737547+tushar-deepsource@users.noreply.github.com> Date: Mon, 26 Jun 2023 12:14:41 +0530 Subject: [PATCH] Ensure the docstring is a string --- src/_pytest/assertion/rewrite.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index ab83fee32..9ac4d582f 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -687,6 +687,7 @@ class AssertionRewriter(ast.NodeVisitor): expect_docstring and isinstance(item, ast.Expr) and isinstance(item.value, astStr) + and isinstance(item.value.value, str) ): if sys.version_info >= (3, 8): doc = item.value.value