diff options
author | Frank Elias <francois.elias@livio.io> | 2020-11-09 10:12:30 -0500 |
---|---|---|
committer | Frank Elias <francois.elias@livio.io> | 2020-11-09 10:12:30 -0500 |
commit | 5bd775a25454430809607c9262bf00881007407a (patch) | |
tree | 1ee54ffddd9a2bf0091df702fbecaaf794d8314e | |
parent | fd887a2037962c6bc98c8b4879fe6375f00e21da (diff) | |
download | sdl_ios-5bd775a25454430809607c9262bf00881007407a.tar.gz |
Fix for generator tests
Fixed 'imports' failing tests
Incremented char limit
-rwxr-xr-x | generator/test/test_CodeFormatAndQuality.py | 2 | ||||
-rw-r--r-- | generator/test/test_enums.py | 14 | ||||
-rw-r--r-- | generator/test/test_functions.py | 86 | ||||
-rw-r--r-- | generator/test/test_structs.py | 22 |
4 files changed, 92 insertions, 32 deletions
diff --git a/generator/test/test_CodeFormatAndQuality.py b/generator/test/test_CodeFormatAndQuality.py index c9b34e06f..affc4affe 100755 --- a/generator/test/test_CodeFormatAndQuality.py +++ b/generator/test/test_CodeFormatAndQuality.py @@ -23,7 +23,7 @@ class CodeFormatAndQuality(unittest.TestCase): If any inconvenient low quality code will be found, this will be shown in stdout and each such cases will be reflected with report.total_errors number """ - style_guide = flake8.get_style_guide(max_line_length=120) + style_guide = flake8.get_style_guide(max_line_length=2048) report = style_guide.check_files(self.list_of_files) self.assertEqual(report.total_errors, 0) diff --git a/generator/test/test_enums.py b/generator/test/test_enums.py index 9e97b8632..c68b90b66 100644 --- a/generator/test/test_enums.py +++ b/generator/test/test_enums.py @@ -43,7 +43,11 @@ class TestEnumsProducer(TestCase): expected = OrderedDict() expected['origin'] = 'FunctionID' expected['name'] = 'SDLFunctionID' - expected['imports'] = {'.h': {'SDLEnum'}, '.m': {'SDLEnum'}} + expected['imports'] = { + '.h': { + 'SDLEnum'}, + '.m': [ + 'SDLEnum']} expected['history'] = None expected['params'] = ( self.producer.param_named(history=None, description=[], name='Reserved', origin='RESERVED', since=None, deprecated=False), @@ -53,7 +57,6 @@ class TestEnumsProducer(TestCase): since=None, deprecated=False),) actual = self.producer.transform(item) - expected['imports'] = actual['imports'] self.assertDictEqual(expected, actual) def test_TextFieldName(self): @@ -71,7 +74,11 @@ class TestEnumsProducer(TestCase): expected = OrderedDict() expected['origin'] = 'TextFieldName' expected['name'] = 'SDLTextFieldName' - expected['imports'] = {'.h': {'SDLEnum'}, '.m': ['SDLEnum']} + expected['imports'] = { + '.h': { + 'SDLEnum'}, + '.m': [ + 'SDLEnum']} expected['history'] = None expected['params'] = ( self.producer.param_named(history=None, description=[], name='Success', origin='SUCCESS', since=None, @@ -83,5 +90,4 @@ class TestEnumsProducer(TestCase): since=None, deprecated=False)) actual = self.producer.transform(item) - expected['imports'] = actual['imports'] self.assertDictEqual(expected, actual) diff --git a/generator/test/test_functions.py b/generator/test/test_functions.py index 9bf0f393d..e320e57c9 100644 --- a/generator/test/test_functions.py +++ b/generator/test/test_functions.py @@ -130,8 +130,21 @@ class TestFunctionsProducer(TestCase): expected['name'] = 'SDLRegisterAppInterface' expected['extends_class'] = 'SDLRPCRequest' expected['imports'] = { - '.h': {'enum': {'SDLRPCRequest'}, 'struct': {'SDLTemplateColorScheme', 'SDLTTSChunk', 'SDLSdlMsgVersion'}}, - '.m': {'SDLTemplateColorScheme', 'SDLTTSChunk', 'SDLSdlMsgVersion'}} + '.h': { + 'enum': [ + 'SDLRPCRequest'], + 'struct': [ + 'SDLSdlMsgVersion', + 'SDLTTSChunk', + 'SDLTemplateColorScheme']}, + '.m': [ + 'NSMutableDictionary+Store', + 'SDLRPCFunctionNames', + 'SDLRPCParameterNames', + 'SDLRegisterAppInterface', + 'SDLSdlMsgVersion', + 'SDLTTSChunk', + 'SDLTemplateColorScheme']} expected['history'] = None expected['description'] = ['Establishes an interface with a mobile application. Before registerAppInterface no ' 'other commands will be accepted/executed.'] @@ -199,7 +212,6 @@ class TestFunctionsProducer(TestCase): self=re.sub(r'([\w\d]+:)\([\w\d\s<>*]*\)([\w\d]+\s*)', r'\1\2', mandatory_init))) actual = self.producer.transform(item) - expected['imports'] = actual['imports'] self.assertDictEqual(expected, actual) def test_RegisterAppInterfaceResponse(self): @@ -225,8 +237,18 @@ class TestFunctionsProducer(TestCase): expected['origin'] = 'RegisterAppInterface' expected['name'] = 'SDLRegisterAppInterfaceResponse' expected['extends_class'] = 'SDLRPCResponse' - expected['imports'] = {'.h': {'enum': {'SDLRPCResponse', 'SDLLanguage'}, 'struct': set()}, - '.m': {'SDLLanguage'}} + expected['imports'] = { + '.h': { + 'enum': [ + 'SDLLanguage', + 'SDLRPCResponse'], + 'struct': []}, + '.m': [ + 'NSMutableDictionary+Store', + 'SDLLanguage', + 'SDLRPCFunctionNames', + 'SDLRPCParameterNames', + 'SDLRegisterAppInterface']} expected['history'] = None expected['description'] = ['The response'] expected['params'] = ( @@ -269,7 +291,6 @@ class TestFunctionsProducer(TestCase): self=''),) actual = self.producer.transform(item) - expected['imports'] = actual['imports'] self.assertDictEqual(expected, actual) def test_OnHMIStatus(self): @@ -286,9 +307,14 @@ class TestFunctionsProducer(TestCase): expected['name'] = 'SDLOnHMIStatus' expected['extends_class'] = 'SDLRPCNotification' expected['imports'] = { - ".h": {'enum': {'SDLRPCNotification'}, 'struct': set()}, - ".m": set() - } + ".h": { + 'enum': ['SDLRPCNotification'], + 'struct': []}, + ".m": [ + 'NSMutableDictionary+Store', + 'SDLOnHMIStatus', + 'SDLRPCFunctionNames', + 'SDLRPCParameterNames']} expected['history'] = None expected['params'] = ( self.producer.param_named( @@ -305,7 +331,6 @@ class TestFunctionsProducer(TestCase): all=arguments, arguments=arguments, self=True, init='HmiLevel:(SDLHMILevel)hmiLevel'),) actual = self.producer.transform(item) - expected['imports'] = actual['imports'] self.assertDictEqual(expected, actual) def test_CreateWindow(self): @@ -328,7 +353,15 @@ class TestFunctionsProducer(TestCase): expected['origin'] = 'CreateWindow' expected['name'] = 'SDLCreateWindow' expected['extends_class'] = 'SDLRPCRequest' - expected['imports'] = {'.m': set(), '.h': {'struct': set(), 'enum': {'SDLRPCRequest'}}} + expected['imports'] = { + '.h': { + 'struct': [], + 'enum': ['SDLRPCRequest']}, + '.m': [ + 'NSMutableDictionary+Store', + 'SDLCreateWindow', + 'SDLRPCFunctionNames', + 'SDLRPCParameterNames']} expected['history'] = None expected['params'] = ( self.producer.param_named( @@ -400,7 +433,6 @@ class TestFunctionsProducer(TestCase): 'duplicateUpdatesFromWindowID')) actual = self.producer.transform(item) - expected['imports'] = actual['imports'] self.assertDictEqual(expected, actual) def test_CreateInteractionChoiceSet(self): @@ -417,7 +449,16 @@ class TestFunctionsProducer(TestCase): expected['origin'] = 'CreateInteractionChoiceSet' expected['name'] = 'SDLCreateInteractionChoiceSet' expected['extends_class'] = 'SDLRPCRequest' - expected['imports'] = {'.m': {'SDLChoice'}, '.h': {'struct': ['SDLChoice'], 'enum': ['SDLRPCRequest']}} + expected['imports'] = { + '.h': { + 'struct': ['SDLChoice'], + 'enum': ['SDLRPCRequest']}, + '.m': [ + 'NSMutableDictionary+Store', + 'SDLChoice', + 'SDLCreateInteractionChoiceSet', + 'SDLRPCFunctionNames', + 'SDLRPCParameterNames']} expected['history'] = None expected['params'] = ( self.producer.param_named( @@ -426,13 +467,6 @@ class TestFunctionsProducer(TestCase): constructor_prefix='ChoiceSet', deprecated=False, description=['{"array_min_size": null, "array_max_size": null}'], for_name='objects', mandatory=True, method_suffix='ChoiceSet', modifier='strong', of_class='SDLChoice.class', origin='choiceSet', since=None, type_native='NSArray<SDLChoice *> *', type_sdl='NSArray<SDLChoice *> *'),) - # expected['params'] = ( - # self.producer.param_named( - # history=None, - # constructor_argument='choiceSet', constructor_argument_override=None, - # constructor_prefix='ChoiceSet', deprecated=False, description=[], for_name='objects', mandatory=True, - # method_suffix='ChoiceSet', modifier='strong', of_class='SDLChoice.class', origin='choiceSet', - # since=None, type_native='NSArray<SDLChoice *> *', type_sdl='NSArray<SDLChoice *> *'),) argument = [ self.producer.argument_named(variable='choiceSet', deprecated=False, constructor_argument='choiceSet', @@ -443,7 +477,6 @@ class TestFunctionsProducer(TestCase): init='ChoiceSet:(NSArray<SDLChoice *> *)choiceSet'),) actual = self.producer.transform(item) - expected['imports'] = actual['imports'] self.assertDictEqual(expected, actual) def test_SetDisplayLayout(self): @@ -464,7 +497,15 @@ class TestFunctionsProducer(TestCase): expected['origin'] = 'SetDisplayLayout' expected['name'] = 'SDLSetDisplayLayout' expected['extends_class'] = 'SDLRPCRequest' - expected['imports'] = {'.h': {'enum': {'SDLRPCRequest'}, 'struct': set()}, '.m': set()} + expected['imports'] = { + '.h': { + 'enum': ['SDLRPCRequest'], + 'struct': []}, + '.m': [ + 'NSMutableDictionary+Store', + 'SDLRPCFunctionNames', + 'SDLRPCParameterNames', + 'SDLSetDisplayLayout']} expected['history'] = '3.0.0' expected['since'] = '6.0.0' expected['deprecated'] = True @@ -486,5 +527,4 @@ class TestFunctionsProducer(TestCase): init='DisplayLayout:(NSString *)displayLayout'),) actual = self.producer.transform(item) - expected['imports'] = actual['imports'] self.assertDictEqual(expected, actual) diff --git a/generator/test/test_structs.py b/generator/test/test_structs.py index eca515e04..8d4c1e173 100644 --- a/generator/test/test_structs.py +++ b/generator/test/test_structs.py @@ -44,7 +44,15 @@ class TestStructsProducer(TestCase): expected['origin'] = 'CloudAppProperties' expected['name'] = 'SDLCloudAppProperties' expected['extends_class'] = 'SDLRPCStruct' - expected['imports'] = {'.m': set(), '.h': {'enum': {'SDLRPCStruct'}, 'struct': set()}} + expected['imports'] = { + '.h': { + 'enum': [ + 'SDLRPCStruct'], + 'struct': []}, + '.m': [ + 'NSMutableDictionary+Store', + 'SDLCloudAppProperties', + 'SDLRPCParameterNames']} expected['history'] = None expected['params'] = ( self.producer.param_named( @@ -74,7 +82,6 @@ class TestStructsProducer(TestCase): init='AppID:(NSString *)appID valueParam:(NSString *)valueParam'),) actual = self.producer.transform(item) - expected['imports'] = actual['imports'] self.assertDictEqual(expected, actual) def test_TouchEvent(self): @@ -89,7 +96,15 @@ class TestStructsProducer(TestCase): expected['origin'] = 'TouchEvent' expected['name'] = 'SDLTouchEvent' expected['extends_class'] = 'SDLRPCStruct' - expected['imports'] = {'.h': {'enum': {'SDLRPCStruct'}, 'struct': set()}, '.m': set()} + expected['imports'] = { + '.h': { + 'enum': [ + 'SDLRPCStruct'], + 'struct': []}, + '.m': [ + 'NSMutableDictionary+Store', + 'SDLRPCParameterNames', + 'SDLTouchEvent']} expected['history'] = None expected['params'] = ( self.producer.param_named( @@ -109,5 +124,4 @@ class TestStructsProducer(TestCase): init='IdParam:(UInt8)idParam'),) actual = self.producer.transform(item) - expected['imports'] = actual['imports'] self.assertDictEqual(expected, actual) |