Skip to content

Commit 2befdb1

Browse files
committed
fix djmain changes the error message text
1 parent 72d0551 commit 2befdb1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/test_commands.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ def test_validation_failed_message(self):
140140
stdout=output,
141141
)
142142

143-
self.assertIn("user", output.getvalue())
144-
self.assertIn("783", output.getvalue())
145-
self.assertIn("does not exist", output.getvalue())
143+
output_str = output.getvalue()
144+
self.assertIn("user", output_str)
145+
self.assertIn("783", output_str)
146+
# newer Django (>5.1) changes the error message from "does not exist" to "is not a valid choice"
147+
self.assertTrue(
148+
any(substring in output_str for substring in ["does not exist", "is not a valid choice"]),
149+
f"Output did not contain 'does not exist' or 'is not a valid choice'. Actual output: {output_str}",
150+
)

0 commit comments

Comments
 (0)