How to use iRead method in fMBT

Best Python code snippet using fMBT_python

i_read_only_dictionary21.py

Source:i_read_only_dictionary21.py Github

copy

Full Screen

1# coding: utf-82"""3 Speech Services API v2.04 Speech Services API v2.0. # noqa: E5015 OpenAPI spec version: v2.06 Contact: crservice@microsoft.com7 Generated by: https://github.com/swagger-api/swagger-codegen.git8"""9import pprint10import re # noqa: F40111import six12class IReadOnlyDictionary21(object):13 """NOTE: This class is auto generated by the swagger code generator program.14 Do not edit the class manually.15 """16 """17 Attributes:18 swagger_types (dict): The key is attribute name19 and the value is attribute type.20 attribute_map (dict): The key is attribute name21 and the value is json key in definition.22 """23 swagger_types = {24 '_none': 'list[str]',25 'acoustic': 'list[str]',26 'language': 'list[str]',27 'acoustic_and_language': 'list[str]',28 'custom_voice': 'list[str]',29 'language_generation': 'list[str]',30 'sentiment': 'list[str]',31 'language_identification': 'list[str]',32 'diarization': 'list[str]'33 }34 attribute_map = {35 '_none': 'None',36 'acoustic': 'Acoustic',37 'language': 'Language',38 'acoustic_and_language': 'AcousticAndLanguage',39 'custom_voice': 'CustomVoice',40 'language_generation': 'LanguageGeneration',41 'sentiment': 'Sentiment',42 'language_identification': 'LanguageIdentification',43 'diarization': 'Diarization'44 }45 def __init__(self, _none=None, acoustic=None, language=None, acoustic_and_language=None, custom_voice=None, language_generation=None, sentiment=None, language_identification=None, diarization=None): # noqa: E50146 """IReadOnlyDictionary21 - a model defined in Swagger""" # noqa: E50147 self.__none = None48 self._acoustic = None49 self._language = None50 self._acoustic_and_language = None51 self._custom_voice = None52 self._language_generation = None53 self._sentiment = None54 self._language_identification = None55 self._diarization = None56 self.discriminator = None57 if _none is not None:58 self._none = _none59 if acoustic is not None:60 self.acoustic = acoustic61 if language is not None:62 self.language = language63 if acoustic_and_language is not None:64 self.acoustic_and_language = acoustic_and_language65 if custom_voice is not None:66 self.custom_voice = custom_voice67 if language_generation is not None:68 self.language_generation = language_generation69 if sentiment is not None:70 self.sentiment = sentiment71 if language_identification is not None:72 self.language_identification = language_identification73 if diarization is not None:74 self.diarization = diarization75 @property76 def _none(self):77 """Gets the _none of this IReadOnlyDictionary21. # noqa: E50178 :return: The _none of this IReadOnlyDictionary21. # noqa: E50179 :rtype: list[str]80 """81 return self.__none82 @_none.setter83 def _none(self, _none):84 """Sets the _none of this IReadOnlyDictionary21.85 :param _none: The _none of this IReadOnlyDictionary21. # noqa: E50186 :type: list[str]87 """88 self.__none = _none89 @property90 def acoustic(self):91 """Gets the acoustic of this IReadOnlyDictionary21. # noqa: E50192 :return: The acoustic of this IReadOnlyDictionary21. # noqa: E50193 :rtype: list[str]94 """95 return self._acoustic96 @acoustic.setter97 def acoustic(self, acoustic):98 """Sets the acoustic of this IReadOnlyDictionary21.99 :param acoustic: The acoustic of this IReadOnlyDictionary21. # noqa: E501100 :type: list[str]101 """102 self._acoustic = acoustic103 @property104 def language(self):105 """Gets the language of this IReadOnlyDictionary21. # noqa: E501106 :return: The language of this IReadOnlyDictionary21. # noqa: E501107 :rtype: list[str]108 """109 return self._language110 @language.setter111 def language(self, language):112 """Sets the language of this IReadOnlyDictionary21.113 :param language: The language of this IReadOnlyDictionary21. # noqa: E501114 :type: list[str]115 """116 self._language = language117 @property118 def acoustic_and_language(self):119 """Gets the acoustic_and_language of this IReadOnlyDictionary21. # noqa: E501120 :return: The acoustic_and_language of this IReadOnlyDictionary21. # noqa: E501121 :rtype: list[str]122 """123 return self._acoustic_and_language124 @acoustic_and_language.setter125 def acoustic_and_language(self, acoustic_and_language):126 """Sets the acoustic_and_language of this IReadOnlyDictionary21.127 :param acoustic_and_language: The acoustic_and_language of this IReadOnlyDictionary21. # noqa: E501128 :type: list[str]129 """130 self._acoustic_and_language = acoustic_and_language131 @property132 def custom_voice(self):133 """Gets the custom_voice of this IReadOnlyDictionary21. # noqa: E501134 :return: The custom_voice of this IReadOnlyDictionary21. # noqa: E501135 :rtype: list[str]136 """137 return self._custom_voice138 @custom_voice.setter139 def custom_voice(self, custom_voice):140 """Sets the custom_voice of this IReadOnlyDictionary21.141 :param custom_voice: The custom_voice of this IReadOnlyDictionary21. # noqa: E501142 :type: list[str]143 """144 self._custom_voice = custom_voice145 @property146 def language_generation(self):147 """Gets the language_generation of this IReadOnlyDictionary21. # noqa: E501148 :return: The language_generation of this IReadOnlyDictionary21. # noqa: E501149 :rtype: list[str]150 """151 return self._language_generation152 @language_generation.setter153 def language_generation(self, language_generation):154 """Sets the language_generation of this IReadOnlyDictionary21.155 :param language_generation: The language_generation of this IReadOnlyDictionary21. # noqa: E501156 :type: list[str]157 """158 self._language_generation = language_generation159 @property160 def sentiment(self):161 """Gets the sentiment of this IReadOnlyDictionary21. # noqa: E501162 :return: The sentiment of this IReadOnlyDictionary21. # noqa: E501163 :rtype: list[str]164 """165 return self._sentiment166 @sentiment.setter167 def sentiment(self, sentiment):168 """Sets the sentiment of this IReadOnlyDictionary21.169 :param sentiment: The sentiment of this IReadOnlyDictionary21. # noqa: E501170 :type: list[str]171 """172 self._sentiment = sentiment173 @property174 def language_identification(self):175 """Gets the language_identification of this IReadOnlyDictionary21. # noqa: E501176 :return: The language_identification of this IReadOnlyDictionary21. # noqa: E501177 :rtype: list[str]178 """179 return self._language_identification180 @language_identification.setter181 def language_identification(self, language_identification):182 """Sets the language_identification of this IReadOnlyDictionary21.183 :param language_identification: The language_identification of this IReadOnlyDictionary21. # noqa: E501184 :type: list[str]185 """186 self._language_identification = language_identification187 @property188 def diarization(self):189 """Gets the diarization of this IReadOnlyDictionary21. # noqa: E501190 :return: The diarization of this IReadOnlyDictionary21. # noqa: E501191 :rtype: list[str]192 """193 return self._diarization194 @diarization.setter195 def diarization(self, diarization):196 """Sets the diarization of this IReadOnlyDictionary21.197 :param diarization: The diarization of this IReadOnlyDictionary21. # noqa: E501198 :type: list[str]199 """200 self._diarization = diarization201 def to_dict(self):202 """Returns the model properties as a dict"""203 result = {}204 for attr, _ in six.iteritems(self.swagger_types):205 value = getattr(self, attr)206 if isinstance(value, list):207 result[attr] = list(map(208 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,209 value210 ))211 elif hasattr(value, "to_dict"):212 result[attr] = value.to_dict()213 elif isinstance(value, dict):214 result[attr] = dict(map(215 lambda item: (item[0], item[1].to_dict())216 if hasattr(item[1], "to_dict") else item,217 value.items()218 ))219 else:220 result[attr] = value221 if issubclass(IReadOnlyDictionary21, dict):222 for key, value in self.items():223 result[key] = value224 return result225 def to_str(self):226 """Returns the string representation of the model"""227 return pprint.pformat(self.to_dict())228 def __repr__(self):229 """For `print` and `pprint`"""230 return self.to_str()231 def __eq__(self, other):232 """Returns true if both objects are equal"""233 if not isinstance(other, IReadOnlyDictionary21):234 return False235 return self.__dict__ == other.__dict__236 def __ne__(self, other):237 """Returns true if both objects are not equal"""...

Full Screen

Full Screen

i_read_only_dictionary2.py

Source:i_read_only_dictionary2.py Github

copy

Full Screen

1# coding: utf-82"""3 Speech Services API v2.04 Speech Services API v2.0. # noqa: E5015 OpenAPI spec version: v2.06 Contact: crservice@microsoft.com7 Generated by: https://github.com/swagger-api/swagger-codegen.git8"""9import pprint10import re # noqa: F40111import six12class IReadOnlyDictionary2(object):13 """NOTE: This class is auto generated by the swagger code generator program.14 Do not edit the class manually.15 """16 """17 Attributes:18 swagger_types (dict): The key is attribute name19 and the value is attribute type.20 attribute_map (dict): The key is attribute name21 and the value is json key in definition.22 """23 swagger_types = {24 '_none': 'list[str]',25 'language': 'list[str]',26 'acoustic': 'list[str]',27 'pronunciation': 'list[str]',28 'custom_voice': 'list[str]',29 'language_generation': 'list[str]',30 'audio_files': 'list[str]'31 }32 attribute_map = {33 '_none': 'None',34 'language': 'Language',35 'acoustic': 'Acoustic',36 'pronunciation': 'Pronunciation',37 'custom_voice': 'CustomVoice',38 'language_generation': 'LanguageGeneration',39 'audio_files': 'AudioFiles'40 }41 def __init__(self, _none=None, language=None, acoustic=None, pronunciation=None, custom_voice=None, language_generation=None, audio_files=None): # noqa: E50142 """IReadOnlyDictionary2 - a model defined in Swagger""" # noqa: E50143 self.__none = None44 self._language = None45 self._acoustic = None46 self._pronunciation = None47 self._custom_voice = None48 self._language_generation = None49 self._audio_files = None50 self.discriminator = None51 if _none is not None:52 self._none = _none53 if language is not None:54 self.language = language55 if acoustic is not None:56 self.acoustic = acoustic57 if pronunciation is not None:58 self.pronunciation = pronunciation59 if custom_voice is not None:60 self.custom_voice = custom_voice61 if language_generation is not None:62 self.language_generation = language_generation63 if audio_files is not None:64 self.audio_files = audio_files65 @property66 def _none(self):67 """Gets the _none of this IReadOnlyDictionary2. # noqa: E50168 :return: The _none of this IReadOnlyDictionary2. # noqa: E50169 :rtype: list[str]70 """71 return self.__none72 @_none.setter73 def _none(self, _none):74 """Sets the _none of this IReadOnlyDictionary2.75 :param _none: The _none of this IReadOnlyDictionary2. # noqa: E50176 :type: list[str]77 """78 self.__none = _none79 @property80 def language(self):81 """Gets the language of this IReadOnlyDictionary2. # noqa: E50182 :return: The language of this IReadOnlyDictionary2. # noqa: E50183 :rtype: list[str]84 """85 return self._language86 @language.setter87 def language(self, language):88 """Sets the language of this IReadOnlyDictionary2.89 :param language: The language of this IReadOnlyDictionary2. # noqa: E50190 :type: list[str]91 """92 self._language = language93 @property94 def acoustic(self):95 """Gets the acoustic of this IReadOnlyDictionary2. # noqa: E50196 :return: The acoustic of this IReadOnlyDictionary2. # noqa: E50197 :rtype: list[str]98 """99 return self._acoustic100 @acoustic.setter101 def acoustic(self, acoustic):102 """Sets the acoustic of this IReadOnlyDictionary2.103 :param acoustic: The acoustic of this IReadOnlyDictionary2. # noqa: E501104 :type: list[str]105 """106 self._acoustic = acoustic107 @property108 def pronunciation(self):109 """Gets the pronunciation of this IReadOnlyDictionary2. # noqa: E501110 :return: The pronunciation of this IReadOnlyDictionary2. # noqa: E501111 :rtype: list[str]112 """113 return self._pronunciation114 @pronunciation.setter115 def pronunciation(self, pronunciation):116 """Sets the pronunciation of this IReadOnlyDictionary2.117 :param pronunciation: The pronunciation of this IReadOnlyDictionary2. # noqa: E501118 :type: list[str]119 """120 self._pronunciation = pronunciation121 @property122 def custom_voice(self):123 """Gets the custom_voice of this IReadOnlyDictionary2. # noqa: E501124 :return: The custom_voice of this IReadOnlyDictionary2. # noqa: E501125 :rtype: list[str]126 """127 return self._custom_voice128 @custom_voice.setter129 def custom_voice(self, custom_voice):130 """Sets the custom_voice of this IReadOnlyDictionary2.131 :param custom_voice: The custom_voice of this IReadOnlyDictionary2. # noqa: E501132 :type: list[str]133 """134 self._custom_voice = custom_voice135 @property136 def language_generation(self):137 """Gets the language_generation of this IReadOnlyDictionary2. # noqa: E501138 :return: The language_generation of this IReadOnlyDictionary2. # noqa: E501139 :rtype: list[str]140 """141 return self._language_generation142 @language_generation.setter143 def language_generation(self, language_generation):144 """Sets the language_generation of this IReadOnlyDictionary2.145 :param language_generation: The language_generation of this IReadOnlyDictionary2. # noqa: E501146 :type: list[str]147 """148 self._language_generation = language_generation149 @property150 def audio_files(self):151 """Gets the audio_files of this IReadOnlyDictionary2. # noqa: E501152 :return: The audio_files of this IReadOnlyDictionary2. # noqa: E501153 :rtype: list[str]154 """155 return self._audio_files156 @audio_files.setter157 def audio_files(self, audio_files):158 """Sets the audio_files of this IReadOnlyDictionary2.159 :param audio_files: The audio_files of this IReadOnlyDictionary2. # noqa: E501160 :type: list[str]161 """162 self._audio_files = audio_files163 def to_dict(self):164 """Returns the model properties as a dict"""165 result = {}166 for attr, _ in six.iteritems(self.swagger_types):167 value = getattr(self, attr)168 if isinstance(value, list):169 result[attr] = list(map(170 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,171 value172 ))173 elif hasattr(value, "to_dict"):174 result[attr] = value.to_dict()175 elif isinstance(value, dict):176 result[attr] = dict(map(177 lambda item: (item[0], item[1].to_dict())178 if hasattr(item[1], "to_dict") else item,179 value.items()180 ))181 else:182 result[attr] = value183 if issubclass(IReadOnlyDictionary2, dict):184 for key, value in self.items():185 result[key] = value186 return result187 def to_str(self):188 """Returns the string representation of the model"""189 return pprint.pformat(self.to_dict())190 def __repr__(self):191 """For `print` and `pprint`"""192 return self.to_str()193 def __eq__(self, other):194 """Returns true if both objects are equal"""195 if not isinstance(other, IReadOnlyDictionary2):196 return False197 return self.__dict__ == other.__dict__198 def __ne__(self, other):199 """Returns true if both objects are not equal"""...

Full Screen

Full Screen

os_chmod_test.py

Source:os_chmod_test.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2# Copyright 2021 Damien Nguyen3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15import stat16import astroid17import pylint.testutils18import pytest19import pylint_secure_coding_standard as pylint_scs20try:21 from pylint.testutils import MessageTest22except ImportError:23 from pylint.testutils import Message as MessageTest24class TestSecureCodingStandardChecker(pylint.testutils.CheckerTestCase):25 CHECKER_CLASS = pylint_scs.SecureCodingStandardChecker26 @pytest.mark.parametrize(27 's, expected',28 (29 ('S_IREAD', stat.S_IREAD),30 ('stat.S_IREAD', stat.S_IREAD),31 ('S_IREAD | S_IWRITE', stat.S_IREAD | stat.S_IWRITE),32 ('stat.S_IREAD | stat.S_IWRITE', stat.S_IREAD | stat.S_IWRITE),33 ('stat.S_IREAD | stat.S_IWRITE | S_IXUSR', stat.S_IREAD | stat.S_IWRITE | stat.S_IXUSR),34 ),35 )36 def test_chmod_get_mode(self, s, expected):37 node = astroid.extract_node(s + ' #@')38 assert pylint_scs._chmod_get_mode(node) == expected39 @pytest.mark.parametrize(40 's',41 (42 'stat.ST_MODE',43 'bla.S_IREAD',44 ),45 )46 def test_chmod_get_mode_invalid(self, s):47 node = astroid.extract_node(s + ' #@')48 with pytest.raises(ValueError):49 pylint_scs._chmod_get_mode(node)50 @pytest.mark.parametrize(51 's, expected',52 (53 ('-stat.S_IREAD', -stat.S_IREAD),54 ('~stat.S_IREAD', ~stat.S_IREAD),55 ('not stat.S_IREAD', not stat.S_IREAD),56 ),57 )58 def test_chmod_get_mode_unop(self, s, expected):59 node = astroid.extract_node(s + ' #@')60 assert pylint_scs._chmod_get_mode(node) == expected61 @pytest.mark.parametrize(62 's, expected',63 (64 ('stat.S_IREAD + stat.S_IWRITE', stat.S_IREAD + stat.S_IWRITE),65 ('stat.S_IREAD - stat.S_IWRITE', stat.S_IREAD - stat.S_IWRITE),66 ('stat.S_IREAD * stat.S_IWRITE', stat.S_IREAD * stat.S_IWRITE),67 ('stat.S_IREAD / stat.S_IWRITE', stat.S_IREAD / stat.S_IWRITE),68 ('stat.S_IREAD // stat.S_IWRITE', stat.S_IREAD // stat.S_IWRITE),69 ('stat.S_IREAD % stat.S_IWRITE', stat.S_IREAD % stat.S_IWRITE),70 ('stat.S_IREAD ^ stat.S_IWRITE', stat.S_IREAD ^ stat.S_IWRITE),71 ('stat.S_IREAD | stat.S_IWRITE', stat.S_IREAD | stat.S_IWRITE),72 ('stat.S_IREAD & stat.S_IWRITE', stat.S_IREAD & stat.S_IWRITE),73 ),74 )75 def test_chmod_get_mode_binop(self, s, expected):76 node = astroid.extract_node(s + ' #@')77 assert pylint_scs._chmod_get_mode(node) == expected78 @pytest.mark.parametrize(79 'platform, enabled_platform',80 (81 ('Linux', True),82 ('Darwin', True),83 ('Java', True),84 ('Windows', False),85 ),86 )87 @pytest.mark.parametrize('fname', ('"file.txt"', 'fname'))88 @pytest.mark.parametrize('arg_type', ('', 'mode='), ids=('arg', 'keyword'))89 @pytest.mark.parametrize(90 'forbidden',91 (92 'S_IRGRP', # NB: not actually a forbidden value, only for testing...93 'S_IRWXG',94 'S_IWGRP',95 'S_IXGRP',96 'S_IRWXO',97 'S_IWOTH',98 'S_IXOTH',99 ),100 )101 @pytest.mark.parametrize(102 's',103 (104 '',105 'S_IREAD',106 'S_IREAD | S_IWRITE',107 'S_IRUSR | S_IWUSR | S_IXUSR',108 ),109 ids=lambda s: s if s else '<empty>',110 )111 def test_chmod(self, mocker, platform, enabled_platform, fname, arg_type, forbidden, s):112 mocker.patch('platform.system', lambda: platform)113 if s:114 code = f'os.chmod({fname}, {arg_type}{s} | {forbidden}) #@'115 else:116 code = f'os.chmod({fname}, {arg_type} {forbidden}) #@'117 print(code)118 node = astroid.extract_node(code)119 if enabled_platform and forbidden != 'S_IRGRP':120 with self.assertAddsMessages(121 MessageTest(msg_id='os-chmod-unsafe-permissions', node=node), ignore_position=True122 ):123 self.checker.visit_call(node)124 else:125 with self.assertNoMessages():126 self.checker.visit_call(node)127 @pytest.mark.parametrize('platform', ('Linux', 'Darwin', 'Java', 'Windows'))128 @pytest.mark.parametrize(129 's',130 (131 'os.chmod("file.txt", stat.ST_MODE)',132 'os.chmod("file.txt", other.S_IRWXO)',133 'os.chmod("file.txt", mode)',134 'os.chmod("file.txt", mode=mode)',135 ),136 )137 def test_chmod_no_warning(self, mocker, platform, s):138 mocker.patch('platform.system', lambda: platform)139 node = astroid.extract_node(s)140 with self.assertNoMessages():141 self.checker.visit_call(node)142 @pytest.mark.parametrize(143 'platform, enabled_platform',144 (145 ('Linux', True),146 ('Darwin', True),147 ('Java', True),148 ('Windows', False),149 ),150 )151 @pytest.mark.parametrize('s', ('os.chmod("file")',))152 def test_chmod_invalid_raise(self, mocker, platform, enabled_platform, s):153 mocker.patch('platform.system', lambda: platform)154 node = astroid.extract_node(s)155 if enabled_platform:156 with pytest.raises(RuntimeError):157 self.checker.visit_call(node)158 else:159 with self.assertNoMessages():...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful