You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
replacing "stringcase" python package with internal implementation + generated java and kotlin code (#34949)
* changing matter_idl functions
* changing yaml runner functions
* removing stringcase from config and requirement files
* restyle
* improve string handling
* fixing generated java and kotlin code
* regenerate idl golden image for test_generators.py
* adding unit test
* restyle
* adding unit test to build.GN
This file contains tests for checking five of the case conversion functions, notably: snake_case, CONSTANT_CASE, spinal-case, PascalCase and camelCase.
8
+
9
+
10
+
'''
11
+
inputs= [
12
+
"FooBarBaz",
13
+
"FOOBarBaz",
14
+
"FOOBarBAZ",
15
+
"fooBARBaz",
16
+
"fooBarBAZ",
17
+
"foo BarBaz",
18
+
" FooBarBaz ",
19
+
"foo_bar_baz",
20
+
"FOO-bar-baz",
21
+
"FOO_BAR_BAZ",
22
+
"__FooBarBaz__",
23
+
"_fooBar_Baz_",
24
+
"foo_Bar Baz"
25
+
]
26
+
27
+
28
+
classTestSnakeCase(unittest.TestCase):
29
+
deftest_snake_case(self):
30
+
expected="foo_bar_baz"
31
+
forinputininputs:
32
+
converted=case_convert.to_snake_case(input)
33
+
self.assertEqual(converted, expected, "they are not equal")
34
+
35
+
deftest_constant_case(self):
36
+
expected="FOO_BAR_BAZ"
37
+
forinputininputs:
38
+
converted=case_convert.to_constant_case(input)
39
+
self.assertEqual(converted, expected, "they are not equal")
40
+
41
+
deftest_spinal_case(self):
42
+
expected="foo-bar-baz"
43
+
forinputininputs:
44
+
converted=case_convert.to_spinal_case(input)
45
+
self.assertEqual(converted, expected, "they are not equal")
46
+
47
+
deftest_pascal_case(self):
48
+
expected="FooBarBaz"
49
+
forinputininputs:
50
+
converted=case_convert.to_pascal_case(input)
51
+
self.assertEqual(converted, expected, "they are not equal")
52
+
53
+
deftest_camel_case(self):
54
+
expected="fooBarBaz"
55
+
forinputininputs:
56
+
converted=case_convert.to_camel_case(input)
57
+
self.assertEqual(converted, expected, "they are not equal")
Copy file name to clipboardexpand all lines: scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/SecondClusterFabricDescriptorStruct.kt
+9-9
Original file line number
Diff line number
Diff line change
@@ -48,9 +48,9 @@ class SecondClusterFabricDescriptorStruct (
0 commit comments