How to programatically create StreamField attributes with StreamBlocks on Wagtail?

I have a Wagtail question, but I didn’t know what’s the best place to put it. I have the following setup:

from wagtail import blocks
from wagtail.models import Page

class PlanCardBlock(blocks.StructBlock):
     """Price Card with a plan's name, price"""
     title = blocks.CharBlock(required=True, help_text="Plan's title")
     currency_symbol = blocks.CharBlock(required=True, max_length=3)

class PlanListBlock(blocks.StreamBlock):
     """A collection of price cards"""
     plan = PlanCardBlock()

class PricingPage(Page):
    plans = StreamField(
         [("plans", PlanListBlock())],
         use_json_field=True,
     )

     @property
     def plan_count(self) -> int:
         try:
              return self.plans[0].value.count
         except (IndexError, AttributeError):
             return 

I want test the plan_count method. The challenge is: how to create the plans attribute automatically. I can’t find any help on the docs on the recommended way.