Skip to content

Commit 7569a6d

Browse files
committed
Change function that asserts true if every element is less or equal than 35 bytes for an assertion of every element
1 parent 8639448 commit 7569a6d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/python_testing/TC_LCFG_2_1.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ def pics_TC_LCFG_2_1(self) -> list[str]:
5252
def has_repeated_values(self, list):
5353
return len(list) != len(set(list))
5454

55-
def values_have_maximum_length(self, list, max_lenght):
56-
return all((len(elem.encode('utf-8')) <= max_lenght) for elem in list)
57-
5855
def supported_locales_has_active_locale(self, list, str):
5956
return str in list
6057

@@ -94,11 +91,12 @@ async def test_TC_LCFG_2_1(self):
9491

9592
# Verify maximun number of elements in the SupportedLocales list is 32
9693
asserts.assert_less_equal(len(initial_supported_locales), max_length_list,
97-
"SupportedLocales attribute should have less than " + str(max_length_list) + " elements")
94+
"SupportedLocales attribute should have less than '{max_length_list}' elements")
9895

9996
# Verify values of SupportedLocales attribute have a maximum lenght of 35 bytes
100-
asserts.assert_true(self.values_have_maximum_length(initial_supported_locales, max_lenght_string),
101-
"Values of SupportedLocales attribute should have a maximum lenght of " + str(max_lenght_string) + " bytes")
97+
for elem in initial_supported_locales:
98+
asserts.assert_less_equal(len(elem.encode('utf-8')), max_lenght_string,
99+
"Value '{elem}' in SupportedLocales attribute should have a maximum lenght of '{max_lenght_string}' bytes")
102100

103101
# Step 2: TH reads ActiveLocale attribute from the DUT
104102
self.step(2)
@@ -117,7 +115,7 @@ async def test_TC_LCFG_2_1(self):
117115

118116
# Verify that the value of ActiveLocale attribute has maximum lenght of 35 bytes
119117
asserts.assert_less_equal(len(initial_active_locale), max_lenght_string,
120-
"ActiveLocale attribute should have less than " + str(max_lenght_string) + " bytes")
118+
"ActiveLocale attribute should have less than '{max_lenght_string}' bytes")
121119

122120
# Verify that the ActiveLocale attribute value is present in the SupportedLocales attribute list
123121
asserts.assert_true(self.supported_locales_has_active_locale(initial_supported_locales,

0 commit comments

Comments
 (0)