Repository: wtforms/wtforms (python)

Issue:
Flags repr is useless
The repr of the Flags class shows only the keys, but in wtforms3 flags can have a value, so the mere presence is no longer useful. Instead it should show the value OR omit flags that are false.

Pull request:
display values in Flags repr
This simply displays flags values in the repr
Fixes #714

Patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index 0e90387..da49089 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -5,6 +5,8 @@ Version 3.x.x
 
 Unreleased
 
+- Display :class:`~wtforms.Flags` values in their repr
+
 Version 3.1.0
 -------------
 
diff --git a/src/wtforms/fields/core.py b/src/wtforms/fields/core.py
index 9f6fd57..2aba500 100644
--- a/src/wtforms/fields/core.py
+++ b/src/wtforms/fields/core.py
@@ -420,7 +420,11 @@ class Flags:
         return getattr(self, name)
 
     def __repr__(self):
-        flags = (name for name in dir(self) if not name.startswith("_"))
+        flags = (
+            f"{name}={getattr(self, name)}"
+            for name in dir(self)
+            if not name.startswith("_")
+        )
         return "<wtforms.fields.Flags: {%s}>" % ", ".join(flags)
 
 


Test patch:
diff --git a/tests/fields/test_flags.py b/tests/fields/test_flags.py
index 76dc96b..ebd02c3 100644
--- a/tests/fields/test_flags.py
+++ b/tests/fields/test_flags.py
@@ -31,7 +31,7 @@ def test_unset(flags):
 
 
 def test_repr(flags):
-    assert repr(flags) == "<wtforms.fields.Flags: {required}>"
+    assert repr(flags) == "<wtforms.fields.Flags: {required=True}>"
 
 
 def test_underscore_property(flags):