-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
b4f4d74
commit 1717340
Showing
145 changed files
with
1,437 additions
and
1,311 deletions.
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
integrations/docker/images/stage-2/chip-build-efr32/requirements.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
import unittest | ||
|
||
import matter_idl.generators.filters as case_convert | ||
|
||
''' | ||
This file contains tests for checking five of the case conversion functions, notably: snake_case, CONSTANT_CASE, spinal-case, PascalCase and camelCase. | ||
''' | ||
inputs = [ | ||
"FooBarBaz", | ||
"FOOBarBaz", | ||
"FOOBarBAZ", | ||
"fooBARBaz", | ||
"fooBarBAZ", | ||
"foo BarBaz", | ||
" FooBarBaz ", | ||
"foo_bar_baz", | ||
"FOO-bar-baz", | ||
"FOO_BAR_BAZ", | ||
"__FooBarBaz__", | ||
"_fooBar_Baz_", | ||
"foo_Bar Baz" | ||
] | ||
|
||
|
||
class TestSnakeCase(unittest.TestCase): | ||
def test_snake_case(self): | ||
expected = "foo_bar_baz" | ||
for input in inputs: | ||
converted = case_convert.to_snake_case(input) | ||
self.assertEqual(converted, expected, "they are not equal") | ||
|
||
def test_constant_case(self): | ||
expected = "FOO_BAR_BAZ" | ||
for input in inputs: | ||
converted = case_convert.to_constant_case(input) | ||
self.assertEqual(converted, expected, "they are not equal") | ||
|
||
def test_spinal_case(self): | ||
expected = "foo-bar-baz" | ||
for input in inputs: | ||
converted = case_convert.to_spinal_case(input) | ||
self.assertEqual(converted, expected, "they are not equal") | ||
|
||
def test_pascal_case(self): | ||
expected = "FooBarBaz" | ||
for input in inputs: | ||
converted = case_convert.to_pascal_case(input) | ||
self.assertEqual(converted, expected, "they are not equal") | ||
|
||
def test_camel_case(self): | ||
expected = "fooBarBaz" | ||
for input in inputs: | ||
converted = case_convert.to_camel_case(input) | ||
self.assertEqual(converted, expected, "they are not equal") | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ zip_safe = False | |
install_requires= | ||
lark | ||
jinja2 | ||
stringcase | ||
|
||
[options.package_data] | ||
matter_idl = | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,3 @@ click | |
# scripts/py_matter_idl/matter_idl | ||
jinja2 | ||
lark | ||
stringcase |
Oops, something went wrong.