From f0d92743baf72aed9d105b094cc9364453c9f268 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar <theskumar@users.noreply.github.com> Date: Wed, 17 Aug 2022 14:44:59 +0530 Subject: [PATCH] Improve sample generator for help text in factories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now, the help text generated is class representation (e.g. “<class 'hypha.apply.stream_forms.blocks.CharFieldBlock’>â€) This is confusing while debugging, so replace it with a more familiar format. `e.g. Help text for CharFieldBlock`. --- hypha/apply/stream_forms/testing/factories.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hypha/apply/stream_forms/testing/factories.py b/hypha/apply/stream_forms/testing/factories.py index 4fc5c050a..2a9c5dba2 100644 --- a/hypha/apply/stream_forms/testing/factories.py +++ b/hypha/apply/stream_forms/testing/factories.py @@ -94,7 +94,9 @@ class ParagraphBlockFactory(wagtail_factories.blocks.BlockFactory): class FormFieldBlockFactory(wagtail_factories.StructBlockFactory): default_value = factory.Faker('sentence') field_label = factory.Faker('sentence') - help_text = factory.LazyAttribute(lambda o: str(o._Resolver__step.builder.factory_meta.model)) + help_text = factory.LazyAttribute( + lambda o: f"Help text for {o._Resolver__step.builder.factory_meta.model.__name__}" + ) class Meta: model = stream_blocks.FormFieldBlock -- GitLab