Coverage for src/common/utils.py: 100%
4 statements
« prev ^ index » next coverage.py v7.9.2, created at 2025-08-04 12:59 +0300
« prev ^ index » next coverage.py v7.9.2, created at 2025-08-04 12:59 +0300
1class ChoicesMaxLengthMixin:
3 @classmethod
4 def max_length(cls):
5 """
6 Calculate the maximum length needed for storing choice values.
7 """
8 # Use a generator expression to find the maximum length
9 # len(choice.value) gets the length of each choice's value
10 # max() finds the largest length among all choices
12 return max(len(choice.value) for choice in cls)