Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
_string_concat
(*strings)
Lazy variant of string concatenation, needed for translations that are constructed from multiple parts.
Lazy variant of string concatenation, needed for translations that are constructed from multiple parts.
def _string_concat(*strings): """ Lazy variant of string concatenation, needed for translations that are constructed from multiple parts. """ warnings.warn( 'django.utils.translate.string_concat() is deprecated in ' 'favor of django.utils.text.format_lazy().', RemovedInDjango...
[ "def", "_string_concat", "(", "*", "strings", ")", ":", "warnings", ".", "warn", "(", "'django.utils.translate.string_concat() is deprecated in '", "'favor of django.utils.text.format_lazy().'", ",", "RemovedInDjango21Warning", ",", "stacklevel", "=", "2", ")", "return", "'...
[ 226, 0 ]
[ 235, 50 ]
python
en
['en', 'error', 'th']
False
apply_roles
(roles, objects, persisted)
apply_roles evaluates a list of Role relationships represented as strings. The format of this string is 'role:[user|role]'. When a user is provided, they will be made a member of the role on the LHS. When a role is provided that role will be added to the children of the role on the LHS. This function a...
apply_roles evaluates a list of Role relationships represented as strings. The format of this string is 'role:[user|role]'. When a user is provided, they will be made a member of the role on the LHS. When a role is provided that role will be added to the children of the role on the LHS.
def apply_roles(roles, objects, persisted): """apply_roles evaluates a list of Role relationships represented as strings. The format of this string is 'role:[user|role]'. When a user is provided, they will be made a member of the role on the LHS. When a role is provided that role will be added to the ch...
[ "def", "apply_roles", "(", "roles", ",", "objects", ",", "persisted", ")", ":", "if", "roles", "is", "None", ":", "return", "None", "if", "not", "persisted", ":", "raise", "RuntimeError", "(", "'roles cannot be used when persisted=False'", ")", "for", "role", ...
[ 38, 0 ]
[ 90, 114 ]
python
en
['en', 'en', 'en']
True
generate_users
(organization, teams, superuser, persisted, **kwargs)
generate_users evaluates a mixed list of User objects and strings. If a string is encountered a user with that username is created and added to the lookup dict. If a User object is encountered the User.username is used as a key for the lookup dict. A short hand for assigning a user to a team is available i...
generate_users evaluates a mixed list of User objects and strings. If a string is encountered a user with that username is created and added to the lookup dict. If a User object is encountered the User.username is used as a key for the lookup dict.
def generate_users(organization, teams, superuser, persisted, **kwargs): """generate_users evaluates a mixed list of User objects and strings. If a string is encountered a user with that username is created and added to the lookup dict. If a User object is encountered the User.username is used as a key for ...
[ "def", "generate_users", "(", "organization", ",", "teams", ",", "superuser", ",", "persisted", ",", "*", "*", "kwargs", ")", ":", "users", "=", "{", "}", "key", "=", "'superusers'", "if", "superuser", "else", "'users'", "if", "key", "in", "kwargs", "and...
[ 93, 0 ]
[ 116, 16 ]
python
en
['en', 'en', 'en']
True
generate_teams
(organization, persisted, **kwargs)
generate_teams evalutes a mixed list of Team objects and strings. If a string is encountered a team with that string name is created and added to the lookup dict. If a Team object is encounted the Team.name is used as a key for the lookup dict.
generate_teams evalutes a mixed list of Team objects and strings. If a string is encountered a team with that string name is created and added to the lookup dict. If a Team object is encounted the Team.name is used as a key for the lookup dict.
def generate_teams(organization, persisted, **kwargs): """generate_teams evalutes a mixed list of Team objects and strings. If a string is encountered a team with that string name is created and added to the lookup dict. If a Team object is encounted the Team.name is used as a key for the lookup dict. "...
[ "def", "generate_teams", "(", "organization", ",", "persisted", ",", "*", "*", "kwargs", ")", ":", "teams", "=", "{", "}", "if", "'teams'", "in", "kwargs", "and", "kwargs", ".", "get", "(", "'teams'", ")", "is", "not", "None", ":", "for", "t", "in", ...
[ 119, 0 ]
[ 131, 16 ]
python
en
['en', 'en', 'en']
True
create_survey_spec
(variables=None, default_type='integer', required=True, min=None, max=None)
Returns a valid survey spec for a job template, based on the input argument specifying variable name(s)
Returns a valid survey spec for a job template, based on the input argument specifying variable name(s)
def create_survey_spec(variables=None, default_type='integer', required=True, min=None, max=None): """ Returns a valid survey spec for a job template, based on the input argument specifying variable name(s) """ if isinstance(variables, list): vars_list = variables else: vars_list...
[ "def", "create_survey_spec", "(", "variables", "=", "None", ",", "default_type", "=", "'integer'", ",", "required", "=", "True", ",", "min", "=", "None", ",", "max", "=", "None", ")", ":", "if", "isinstance", "(", "variables", ",", "list", ")", ":", "v...
[ 142, 0 ]
[ 191, 22 ]
python
en
['en', 'error', 'th']
False
create_workflow_job_template
(name, organization=None, persisted=True, webhook_service='', **kwargs)
if 'jobs' in kwargs: for i in kwargs['jobs']: if type(i) is Job: jobs[i.pk] = i else: # TODO: Create the job raise RuntimeError("Currently, only already created jobs are supported")
if 'jobs' in kwargs: for i in kwargs['jobs']: if type(i) is Job: jobs[i.pk] = i else: # TODO: Create the job raise RuntimeError("Currently, only already created jobs are supported")
def create_workflow_job_template(name, organization=None, persisted=True, webhook_service='', **kwargs): Objects = generate_objects( [ "workflow_job_template", "workflow_job_template_nodes", "survey", ], kwargs, ) spec = None # jobs = None ...
[ "def", "create_workflow_job_template", "(", "name", ",", "organization", "=", "None", ",", "persisted", "=", "True", ",", "webhook_service", "=", "''", ",", "*", "*", "kwargs", ")", ":", "Objects", "=", "generate_objects", "(", "[", "\"workflow_job_template\"", ...
[ 428, 0 ]
[ 464, 5 ]
python
en
['en', 'error', 'th']
False
PasswordResetTokenGenerator.make_token
(self, user)
Returns a token that can be used once to do a password reset for the given user.
Returns a token that can be used once to do a password reset for the given user.
def make_token(self, user): """ Returns a token that can be used once to do a password reset for the given user. """ return self._make_token_with_timestamp(user, self._num_days(self._today()))
[ "def", "make_token", "(", "self", ",", "user", ")", ":", "return", "self", ".", "_make_token_with_timestamp", "(", "user", ",", "self", ".", "_num_days", "(", "self", ".", "_today", "(", ")", ")", ")" ]
[ 15, 4 ]
[ 20, 83 ]
python
en
['en', 'error', 'th']
False
PasswordResetTokenGenerator.check_token
(self, user, token)
Check that a password reset token is correct for a given user.
Check that a password reset token is correct for a given user.
def check_token(self, user, token): """ Check that a password reset token is correct for a given user. """ if not (user and token): return False # Parse the token try: ts_b36, hash = token.split("-") except ValueError: return Fa...
[ "def", "check_token", "(", "self", ",", "user", ",", "token", ")", ":", "if", "not", "(", "user", "and", "token", ")", ":", "return", "False", "# Parse the token", "try", ":", "ts_b36", ",", "hash", "=", "token", ".", "split", "(", "\"-\"", ")", "exc...
[ 22, 4 ]
[ 47, 19 ]
python
en
['en', 'error', 'th']
False
retry
(*dargs, **dkw)
Decorator function that instantiates the Retrying object @param *dargs: positional arguments passed to Retrying object @param **dkw: keyword arguments passed to the Retrying object
Decorator function that instantiates the Retrying object
def retry(*dargs, **dkw): """ Decorator function that instantiates the Retrying object @param *dargs: positional arguments passed to Retrying object @param **dkw: keyword arguments passed to the Retrying object """ # support both @retry and @retry() as valid syntax if len(dargs) == 1 and cal...
[ "def", "retry", "(", "*", "dargs", ",", "*", "*", "dkw", ")", ":", "# support both @retry and @retry() as valid syntax", "if", "len", "(", "dargs", ")", "==", "1", "and", "callable", "(", "dargs", "[", "0", "]", ")", ":", "def", "wrap_simple", "(", "f", ...
[ 25, 0 ]
[ 52, 19 ]
python
en
['en', 'error', 'th']
False
Retrying.stop_after_attempt
(self, previous_attempt_number, delay_since_first_attempt_ms)
Stop after the previous attempt >= stop_max_attempt_number.
Stop after the previous attempt >= stop_max_attempt_number.
def stop_after_attempt(self, previous_attempt_number, delay_since_first_attempt_ms): """Stop after the previous attempt >= stop_max_attempt_number.""" return previous_attempt_number >= self._stop_max_attempt_number
[ "def", "stop_after_attempt", "(", "self", ",", "previous_attempt_number", ",", "delay_since_first_attempt_ms", ")", ":", "return", "previous_attempt_number", ">=", "self", ".", "_stop_max_attempt_number" ]
[ 140, 4 ]
[ 142, 71 ]
python
en
['en', 'en', 'en']
True
Retrying.stop_after_delay
(self, previous_attempt_number, delay_since_first_attempt_ms)
Stop after the time from the first attempt >= stop_max_delay.
Stop after the time from the first attempt >= stop_max_delay.
def stop_after_delay(self, previous_attempt_number, delay_since_first_attempt_ms): """Stop after the time from the first attempt >= stop_max_delay.""" return delay_since_first_attempt_ms >= self._stop_max_delay
[ "def", "stop_after_delay", "(", "self", ",", "previous_attempt_number", ",", "delay_since_first_attempt_ms", ")", ":", "return", "delay_since_first_attempt_ms", ">=", "self", ".", "_stop_max_delay" ]
[ 144, 4 ]
[ 146, 67 ]
python
en
['en', 'en', 'en']
True
Retrying.no_sleep
(self, previous_attempt_number, delay_since_first_attempt_ms)
Don't sleep at all before retrying.
Don't sleep at all before retrying.
def no_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """Don't sleep at all before retrying.""" return 0
[ "def", "no_sleep", "(", "self", ",", "previous_attempt_number", ",", "delay_since_first_attempt_ms", ")", ":", "return", "0" ]
[ 148, 4 ]
[ 150, 16 ]
python
en
['en', 'en', 'en']
True
Retrying.fixed_sleep
(self, previous_attempt_number, delay_since_first_attempt_ms)
Sleep a fixed amount of time between each retry.
Sleep a fixed amount of time between each retry.
def fixed_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """Sleep a fixed amount of time between each retry.""" return self._wait_fixed
[ "def", "fixed_sleep", "(", "self", ",", "previous_attempt_number", ",", "delay_since_first_attempt_ms", ")", ":", "return", "self", ".", "_wait_fixed" ]
[ 152, 4 ]
[ 154, 31 ]
python
en
['en', 'en', 'en']
True
Retrying.random_sleep
(self, previous_attempt_number, delay_since_first_attempt_ms)
Sleep a random amount of time between wait_random_min and wait_random_max
Sleep a random amount of time between wait_random_min and wait_random_max
def random_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """Sleep a random amount of time between wait_random_min and wait_random_max""" return random.randint(self._wait_random_min, self._wait_random_max)
[ "def", "random_sleep", "(", "self", ",", "previous_attempt_number", ",", "delay_since_first_attempt_ms", ")", ":", "return", "random", ".", "randint", "(", "self", ".", "_wait_random_min", ",", "self", ".", "_wait_random_max", ")" ]
[ 156, 4 ]
[ 158, 75 ]
python
en
['en', 'so', 'en']
True
Retrying.incrementing_sleep
(self, previous_attempt_number, delay_since_first_attempt_ms)
Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment
Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment
def incrementing_sleep(self, previous_attempt_number, delay_since_first_attempt_ms): """ Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment """ result = self._wait_incrementing_start + (self....
[ "def", "incrementing_sleep", "(", "self", ",", "previous_attempt_number", ",", "delay_since_first_attempt_ms", ")", ":", "result", "=", "self", ".", "_wait_incrementing_start", "+", "(", "self", ".", "_wait_incrementing_increment", "*", "(", "previous_attempt_number", "...
[ 160, 4 ]
[ 168, 21 ]
python
en
['en', 'error', 'th']
False
Attempt.get
(self, wrap_exception=False)
Return the return value of this Attempt instance or raise an Exception. If wrap_exception is true, this Attempt is wrapped inside of a RetryError before being raised.
Return the return value of this Attempt instance or raise an Exception. If wrap_exception is true, this Attempt is wrapped inside of a RetryError before being raised.
def get(self, wrap_exception=False): """ Return the return value of this Attempt instance or raise an Exception. If wrap_exception is true, this Attempt is wrapped inside of a RetryError before being raised. """ if self.has_exception: if wrap_exception: ...
[ "def", "get", "(", "self", ",", "wrap_exception", "=", "False", ")", ":", "if", "self", ".", "has_exception", ":", "if", "wrap_exception", ":", "raise", "RetryError", "(", "self", ")", "else", ":", "six", ".", "reraise", "(", "self", ".", "value", "[",...
[ 236, 4 ]
[ 248, 29 ]
python
en
['en', 'error', 'th']
False
_best_version
(fields)
Detect the best version depending on the fields used.
Detect the best version depending on the fields used.
def _best_version(fields): """Detect the best version depending on the fields used.""" def _has_marker(keys, markers): for marker in markers: if marker in keys: return True return False keys = [] for key, value in fields.items(): if value in ([], 'UNK...
[ "def", "_best_version", "(", "fields", ")", ":", "def", "_has_marker", "(", "keys", ",", "markers", ")", ":", "for", "marker", "in", "markers", ":", "if", "marker", "in", "keys", ":", "return", "True", "return", "False", "keys", "=", "[", "]", "for", ...
[ 125, 0 ]
[ 194, 16 ]
python
en
['en', 'en', 'en']
True
_get_name_and_version
(name, version, for_filename=False)
Return the distribution name with version. If for_filename is true, return a filename-escaped form.
Return the distribution name with version.
def _get_name_and_version(name, version, for_filename=False): """Return the distribution name with version. If for_filename is true, return a filename-escaped form.""" if for_filename: # For both name and version any runs of non-alphanumeric or '.' # characters are replaced with a single '-...
[ "def", "_get_name_and_version", "(", "name", ",", "version", ",", "for_filename", "=", "False", ")", ":", "if", "for_filename", ":", "# For both name and version any runs of non-alphanumeric or '.'", "# characters are replaced with a single '-'. Additionally any", "# spaces in the...
[ 222, 0 ]
[ 232, 36 ]
python
en
['en', 'en', 'en']
True
LegacyMetadata.get_fullname
(self, filesafe=False)
Return the distribution name with version. If filesafe is true, return a filename-escaped form.
Return the distribution name with version.
def get_fullname(self, filesafe=False): """Return the distribution name with version. If filesafe is true, return a filename-escaped form.""" return _get_name_and_version(self['Name'], self['Version'], filesafe)
[ "def", "get_fullname", "(", "self", ",", "filesafe", "=", "False", ")", ":", "return", "_get_name_and_version", "(", "self", "[", "'Name'", "]", ",", "self", "[", "'Version'", "]", ",", "filesafe", ")" ]
[ 314, 4 ]
[ 318, 77 ]
python
en
['en', 'en', 'en']
True
LegacyMetadata.is_field
(self, name)
return True if name is a valid metadata key
return True if name is a valid metadata key
def is_field(self, name): """return True if name is a valid metadata key""" name = self._convert_name(name) return name in _ALL_FIELDS
[ "def", "is_field", "(", "self", ",", "name", ")", ":", "name", "=", "self", ".", "_convert_name", "(", "name", ")", "return", "name", "in", "_ALL_FIELDS" ]
[ 320, 4 ]
[ 323, 34 ]
python
en
['en', 'et', 'en']
True
LegacyMetadata.read
(self, filepath)
Read the metadata values from a file path.
Read the metadata values from a file path.
def read(self, filepath): """Read the metadata values from a file path.""" fp = codecs.open(filepath, 'r', encoding='utf-8') try: self.read_file(fp) finally: fp.close()
[ "def", "read", "(", "self", ",", "filepath", ")", ":", "fp", "=", "codecs", ".", "open", "(", "filepath", ",", "'r'", ",", "encoding", "=", "'utf-8'", ")", "try", ":", "self", ".", "read_file", "(", "fp", ")", "finally", ":", "fp", ".", "close", ...
[ 329, 4 ]
[ 335, 22 ]
python
en
['en', 'en', 'en']
True
LegacyMetadata.read_file
(self, fileob)
Read the metadata values from a file object.
Read the metadata values from a file object.
def read_file(self, fileob): """Read the metadata values from a file object.""" msg = message_from_file(fileob) self._fields['Metadata-Version'] = msg['metadata-version'] # When reading, get all the fields we can for field in _ALL_FIELDS: if field not in msg: ...
[ "def", "read_file", "(", "self", ",", "fileob", ")", ":", "msg", "=", "message_from_file", "(", "fileob", ")", "self", ".", "_fields", "[", "'Metadata-Version'", "]", "=", "msg", "[", "'metadata-version'", "]", "# When reading, get all the fields we can", "for", ...
[ 337, 4 ]
[ 361, 67 ]
python
en
['en', 'en', 'en']
True
LegacyMetadata.write
(self, filepath, skip_unknown=False)
Write the metadata fields to filepath.
Write the metadata fields to filepath.
def write(self, filepath, skip_unknown=False): """Write the metadata fields to filepath.""" fp = codecs.open(filepath, 'w', encoding='utf-8') try: self.write_file(fp, skip_unknown) finally: fp.close()
[ "def", "write", "(", "self", ",", "filepath", ",", "skip_unknown", "=", "False", ")", ":", "fp", "=", "codecs", ".", "open", "(", "filepath", ",", "'w'", ",", "encoding", "=", "'utf-8'", ")", "try", ":", "self", ".", "write_file", "(", "fp", ",", "...
[ 365, 4 ]
[ 371, 22 ]
python
en
['en', 'el-Latn', 'en']
True
LegacyMetadata.write_file
(self, fileobject, skip_unknown=False)
Write the PKG-INFO format data to a file object.
Write the PKG-INFO format data to a file object.
def write_file(self, fileobject, skip_unknown=False): """Write the PKG-INFO format data to a file object.""" self.set_metadata_version() for field in _version2fieldlist(self['Metadata-Version']): values = self.get(field) if skip_unknown and values in ('UNKNOWN', [], ['UN...
[ "def", "write_file", "(", "self", ",", "fileobject", ",", "skip_unknown", "=", "False", ")", ":", "self", ".", "set_metadata_version", "(", ")", "for", "field", "in", "_version2fieldlist", "(", "self", "[", "'Metadata-Version'", "]", ")", ":", "values", "=",...
[ 373, 4 ]
[ 396, 59 ]
python
en
['en', 'en', 'en']
True
LegacyMetadata.update
(self, other=None, **kwargs)
Set metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value)`` iterables. Keys that don't match a met...
Set metadata values from the given iterable `other` and kwargs.
def update(self, other=None, **kwargs): """Set metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value...
[ "def", "update", "(", "self", ",", "other", "=", "None", ",", "*", "*", "kwargs", ")", ":", "def", "_set", "(", "key", ",", "value", ")", ":", "if", "key", "in", "_ATTR2FIELD", "and", "value", ":", "self", ".", "set", "(", "self", ".", "_convert_...
[ 398, 4 ]
[ 424, 26 ]
python
en
['en', 'en', 'en']
True
LegacyMetadata.set
(self, name, value)
Control then set a metadata field.
Control then set a metadata field.
def set(self, name, value): """Control then set a metadata field.""" name = self._convert_name(name) if ((name in _ELEMENTSFIELD or name == 'Platform') and not isinstance(value, (list, tuple))): if isinstance(value, string_types): value = [v.strip() for v...
[ "def", "set", "(", "self", ",", "name", ",", "value", ")", ":", "name", "=", "self", ".", "_convert_name", "(", "name", ")", "if", "(", "(", "name", "in", "_ELEMENTSFIELD", "or", "name", "==", "'Platform'", ")", "and", "not", "isinstance", "(", "valu...
[ 426, 4 ]
[ 468, 34 ]
python
en
['en', 'lb', 'en']
True
LegacyMetadata.get
(self, name, default=_MISSING)
Get a metadata field.
Get a metadata field.
def get(self, name, default=_MISSING): """Get a metadata field.""" name = self._convert_name(name) if name not in self._fields: if default is _MISSING: default = self._default_value(name) return default if name in _UNICODEFIELDS: value ...
[ "def", "get", "(", "self", ",", "name", ",", "default", "=", "_MISSING", ")", ":", "name", "=", "self", ".", "_convert_name", "(", "name", ")", "if", "name", "not", "in", "self", ".", "_fields", ":", "if", "default", "is", "_MISSING", ":", "default",...
[ 470, 4 ]
[ 497, 33 ]
python
en
['ro', 'lb', 'en']
False
LegacyMetadata.check
(self, strict=False)
Check if the metadata is compliant. If strict is True then raise if no Name or Version are provided
Check if the metadata is compliant. If strict is True then raise if no Name or Version are provided
def check(self, strict=False): """Check if the metadata is compliant. If strict is True then raise if no Name or Version are provided""" self.set_metadata_version() # XXX should check the versions (if the file was loaded) missing, warnings = [], [] for attr in ('Name', ...
[ "def", "check", "(", "self", ",", "strict", "=", "False", ")", ":", "self", ".", "set_metadata_version", "(", ")", "# XXX should check the versions (if the file was loaded)", "missing", ",", "warnings", "=", "[", "]", ",", "[", "]", "for", "attr", "in", "(", ...
[ 499, 4 ]
[ 541, 32 ]
python
en
['en', 'en', 'en']
True
LegacyMetadata.todict
(self, skip_missing=False)
Return fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page). This is as per https://www.python.org/dev/peps/pep-0566/#id17.
Return fields as a dict.
def todict(self, skip_missing=False): """Return fields as a dict. Field names will be converted to use the underscore-lowercase style instead of hyphen-mixed case (i.e. home_page instead of Home-page). This is as per https://www.python.org/dev/peps/pep-0566/#id17. """ se...
[ "def", "todict", "(", "self", ",", "skip_missing", "=", "False", ")", ":", "self", ".", "set_metadata_version", "(", ")", "fields", "=", "_version2fieldlist", "(", "self", "[", "'Metadata-Version'", "]", ")", "data", "=", "{", "}", "for", "field_name", "in...
[ 543, 4 ]
[ 564, 19 ]
python
en
['en', 'en', 'en']
True
Metadata.get_requirements
(self, reqts, extras=None, env=None)
Base method to get dependencies, given a set of extras to satisfy and an optional environment context. :param reqts: A list of sometimes-wanted dependencies, perhaps dependent on extras and environment. :param extras: A list of optional components being requested. ...
Base method to get dependencies, given a set of extras to satisfy and an optional environment context. :param reqts: A list of sometimes-wanted dependencies, perhaps dependent on extras and environment. :param extras: A list of optional components being requested. ...
def get_requirements(self, reqts, extras=None, env=None): """ Base method to get dependencies, given a set of extras to satisfy and an optional environment context. :param reqts: A list of sometimes-wanted dependencies, perhaps dependent on extras and environment. ...
[ "def", "get_requirements", "(", "self", ",", "reqts", ",", "extras", "=", "None", ",", "env", "=", "None", ")", ":", "if", "self", ".", "_legacy", ":", "result", "=", "reqts", "else", ":", "result", "=", "[", "]", "extras", "=", "get_extras", "(", ...
[ 824, 4 ]
[ 864, 21 ]
python
en
['en', 'error', 'th']
False
GenDep.test_dependencies_list
(self)
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
def test_dependencies_list(self): """ Test that gen_dep() correctly creates dependencies for given dependency list. :return: """ dependencies = ['DEP1', 'DEP2'] dep_start, dep_end = gen_dependencies(dependencies) preprocessor1, preprocessor2 = dep_start.sp...
[ "def", "test_dependencies_list", "(", "self", ")", ":", "dependencies", "=", "[", "'DEP1'", ",", "'DEP2'", "]", "dep_start", ",", "dep_end", "=", "gen_dependencies", "(", "dependencies", ")", "preprocessor1", ",", "preprocessor2", "=", "dep_start", ".", "splitli...
[ 58, 4 ]
[ 75, 62 ]
python
en
['en', 'error', 'th']
False
GenDep.test_disabled_dependencies_list
(self)
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
def test_disabled_dependencies_list(self): """ Test that gen_dep() correctly creates dependencies for given dependency list. :return: """ dependencies = ['!DEP1', '!DEP2'] dep_start, dep_end = gen_dependencies(dependencies) preprocessor1, preprocessor2 = d...
[ "def", "test_disabled_dependencies_list", "(", "self", ")", ":", "dependencies", "=", "[", "'!DEP1'", ",", "'!DEP2'", "]", "dep_start", ",", "dep_end", "=", "gen_dependencies", "(", "dependencies", ")", "preprocessor1", ",", "preprocessor2", "=", "dep_start", ".",...
[ 77, 4 ]
[ 94, 62 ]
python
en
['en', 'error', 'th']
False
GenDep.test_mixed_dependencies_list
(self)
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
def test_mixed_dependencies_list(self): """ Test that gen_dep() correctly creates dependencies for given dependency list. :return: """ dependencies = ['!DEP1', 'DEP2'] dep_start, dep_end = gen_dependencies(dependencies) preprocessor1, preprocessor2 = dep_s...
[ "def", "test_mixed_dependencies_list", "(", "self", ")", ":", "dependencies", "=", "[", "'!DEP1'", ",", "'DEP2'", "]", "dep_start", ",", "dep_end", "=", "gen_dependencies", "(", "dependencies", ")", "preprocessor1", ",", "preprocessor2", "=", "dep_start", ".", "...
[ 96, 4 ]
[ 113, 62 ]
python
en
['en', 'error', 'th']
False
GenDep.test_empty_dependencies_list
(self)
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
def test_empty_dependencies_list(self): """ Test that gen_dep() correctly creates dependencies for given dependency list. :return: """ dependencies = [] dep_start, dep_end = gen_dependencies(dependencies) self.assertEqual(dep_start, '', 'Preprocessor gener...
[ "def", "test_empty_dependencies_list", "(", "self", ")", ":", "dependencies", "=", "[", "]", "dep_start", ",", "dep_end", "=", "gen_dependencies", "(", "dependencies", ")", "self", ".", "assertEqual", "(", "dep_start", ",", "''", ",", "'Preprocessor generated inco...
[ 115, 4 ]
[ 124, 75 ]
python
en
['en', 'error', 'th']
False
GenDep.test_large_dependencies_list
(self)
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
def test_large_dependencies_list(self): """ Test that gen_dep() correctly creates dependencies for given dependency list. :return: """ dependencies = [] count = 10 for i in range(count): dependencies.append('DEP%d' % i) dep_start, dep_e...
[ "def", "test_large_dependencies_list", "(", "self", ")", ":", "dependencies", "=", "[", "]", "count", "=", "10", "for", "i", "in", "range", "(", "count", ")", ":", "dependencies", ".", "append", "(", "'DEP%d'", "%", "i", ")", "dep_start", ",", "dep_end",...
[ 126, 4 ]
[ 140, 62 ]
python
en
['en', 'error', 'th']
False
GenDepOneLine.test_dependencies_list
(self)
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
def test_dependencies_list(self): """ Test that gen_dep() correctly creates dependencies for given dependency list. :return: """ dependencies = ['DEP1', 'DEP2'] dep_str = gen_dependencies_one_line(dependencies) self.assertEqual(dep_str, '#if defined(DEP1) ...
[ "def", "test_dependencies_list", "(", "self", ")", ":", "dependencies", "=", "[", "'DEP1'", ",", "'DEP2'", "]", "dep_str", "=", "gen_dependencies_one_line", "(", "dependencies", ")", "self", ".", "assertEqual", "(", "dep_str", ",", "'#if defined(DEP1) && defined(DEP...
[ 148, 4 ]
[ 157, 62 ]
python
en
['en', 'error', 'th']
False
GenDepOneLine.test_disabled_dependencies_list
(self)
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
def test_disabled_dependencies_list(self): """ Test that gen_dep() correctly creates dependencies for given dependency list. :return: """ dependencies = ['!DEP1', '!DEP2'] dep_str = gen_dependencies_one_line(dependencies) self.assertEqual(dep_str, '#if !de...
[ "def", "test_disabled_dependencies_list", "(", "self", ")", ":", "dependencies", "=", "[", "'!DEP1'", ",", "'!DEP2'", "]", "dep_str", "=", "gen_dependencies_one_line", "(", "dependencies", ")", "self", ".", "assertEqual", "(", "dep_str", ",", "'#if !defined(DEP1) &&...
[ 159, 4 ]
[ 168, 62 ]
python
en
['en', 'error', 'th']
False
GenDepOneLine.test_mixed_dependencies_list
(self)
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
def test_mixed_dependencies_list(self): """ Test that gen_dep() correctly creates dependencies for given dependency list. :return: """ dependencies = ['!DEP1', 'DEP2'] dep_str = gen_dependencies_one_line(dependencies) self.assertEqual(dep_str, '#if !define...
[ "def", "test_mixed_dependencies_list", "(", "self", ")", ":", "dependencies", "=", "[", "'!DEP1'", ",", "'DEP2'", "]", "dep_str", "=", "gen_dependencies_one_line", "(", "dependencies", ")", "self", ".", "assertEqual", "(", "dep_str", ",", "'#if !defined(DEP1) && def...
[ 170, 4 ]
[ 179, 62 ]
python
en
['en', 'error', 'th']
False
GenDepOneLine.test_empty_dependencies_list
(self)
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
def test_empty_dependencies_list(self): """ Test that gen_dep() correctly creates dependencies for given dependency list. :return: """ dependencies = [] dep_str = gen_dependencies_one_line(dependencies) self.assertEqual(dep_str, '', 'Preprocessor generated...
[ "def", "test_empty_dependencies_list", "(", "self", ")", ":", "dependencies", "=", "[", "]", "dep_str", "=", "gen_dependencies_one_line", "(", "dependencies", ")", "self", ".", "assertEqual", "(", "dep_str", ",", "''", ",", "'Preprocessor generated incorrectly'", ")...
[ 181, 4 ]
[ 189, 75 ]
python
en
['en', 'error', 'th']
False
GenDepOneLine.test_large_dependencies_list
(self)
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
Test that gen_dep() correctly creates dependencies for given dependency list. :return:
def test_large_dependencies_list(self): """ Test that gen_dep() correctly creates dependencies for given dependency list. :return: """ dependencies = [] count = 10 for i in range(count): dependencies.append('DEP%d' % i) dep_str = gen_de...
[ "def", "test_large_dependencies_list", "(", "self", ")", ":", "dependencies", "=", "[", "]", "count", "=", "10", "for", "i", "in", "range", "(", "count", ")", ":", "dependencies", ".", "append", "(", "'DEP%d'", "%", "i", ")", "dep_str", "=", "gen_depende...
[ 191, 4 ]
[ 205, 62 ]
python
en
['en', 'error', 'th']
False
GenFunctionWrapper.test_params_unpack
(self)
Test that params are properly unpacked in the function call. :return:
Test that params are properly unpacked in the function call.
def test_params_unpack(self): """ Test that params are properly unpacked in the function call. :return: """ code = gen_function_wrapper('test_a', '', ('a', 'b', 'c', 'd')) expected = ''' void test_a_wrapper( void ** params ) { test_a( a, b, c, d ); } ''' sel...
[ "def", "test_params_unpack", "(", "self", ")", ":", "code", "=", "gen_function_wrapper", "(", "'test_a'", ",", "''", ",", "(", "'a'", ",", "'b'", ",", "'c'", ",", "'d'", ")", ")", "expected", "=", "'''\nvoid test_a_wrapper( void ** params )\n{\n\n test_a( a, b,...
[ 213, 4 ]
[ 227, 40 ]
python
en
['en', 'error', 'th']
False
GenFunctionWrapper.test_local
(self)
Test that params are properly unpacked in the function call. :return:
Test that params are properly unpacked in the function call.
def test_local(self): """ Test that params are properly unpacked in the function call. :return: """ code = gen_function_wrapper('test_a', 'int x = 1;', ('x', 'b', 'c', 'd')) expected = ''' void test_a_wrapper( void ** params ) { int x ...
[ "def", "test_local", "(", "self", ")", ":", "code", "=", "gen_function_wrapper", "(", "'test_a'", ",", "'int x = 1;'", ",", "(", "'x'", ",", "'b'", ",", "'c'", ",", "'d'", ")", ")", "expected", "=", "'''\nvoid test_a_wrapper( void ** params )\n{\nint x = 1;\n t...
[ 229, 4 ]
[ 244, 40 ]
python
en
['en', 'error', 'th']
False
GenFunctionWrapper.test_empty_params
(self)
Test that params are properly unpacked in the function call. :return:
Test that params are properly unpacked in the function call.
def test_empty_params(self): """ Test that params are properly unpacked in the function call. :return: """ code = gen_function_wrapper('test_a', '', ()) expected = ''' void test_a_wrapper( void ** params ) { (void)params; test_a( ); } ''' self.assertEqu...
[ "def", "test_empty_params", "(", "self", ")", ":", "code", "=", "gen_function_wrapper", "(", "'test_a'", ",", "''", ",", "(", ")", ")", "expected", "=", "'''\nvoid test_a_wrapper( void ** params )\n{\n (void)params;\n\n test_a( );\n}\n'''", "self", ".", "assertEqua...
[ 246, 4 ]
[ 261, 40 ]
python
en
['en', 'error', 'th']
False
GenDispatch.test_dispatch
(self)
Test that dispatch table entry is generated correctly. :return:
Test that dispatch table entry is generated correctly. :return:
def test_dispatch(self): """ Test that dispatch table entry is generated correctly. :return: """ code = gen_dispatch('test_a', ['DEP1', 'DEP2']) expected = ''' #if defined(DEP1) && defined(DEP2) test_a_wrapper, #else NULL, #endif ''' self.assertEqual(code,...
[ "def", "test_dispatch", "(", "self", ")", ":", "code", "=", "gen_dispatch", "(", "'test_a'", ",", "[", "'DEP1'", ",", "'DEP2'", "]", ")", "expected", "=", "'''\n#if defined(DEP1) && defined(DEP2)\n test_a_wrapper,\n#else\n NULL,\n#endif\n'''", "self", ".", "assert...
[ 269, 4 ]
[ 282, 40 ]
python
en
['en', 'error', 'th']
False
GenDispatch.test_empty_dependencies
(self)
Test empty dependency list. :return:
Test empty dependency list. :return:
def test_empty_dependencies(self): """ Test empty dependency list. :return: """ code = gen_dispatch('test_a', []) expected = ''' test_a_wrapper, ''' self.assertEqual(code, expected)
[ "def", "test_empty_dependencies", "(", "self", ")", ":", "code", "=", "gen_dispatch", "(", "'test_a'", ",", "[", "]", ")", "expected", "=", "'''\n test_a_wrapper,\n'''", "self", ".", "assertEqual", "(", "code", ",", "expected", ")" ]
[ 284, 4 ]
[ 293, 40 ]
python
en
['en', 'error', 'th']
False
StringIOWrapper.__init__
(self, file_name, data, line_no=0)
Init file handle. :param file_name: :param data: :param line_no:
Init file handle.
def __init__(self, file_name, data, line_no=0): """ Init file handle. :param file_name: :param data: :param line_no: """ super(StringIOWrapper, self).__init__(data) self.line_no = line_no self.name = file_name
[ "def", "__init__", "(", "self", ",", "file_name", ",", "data", ",", "line_no", "=", "0", ")", ":", "super", "(", "StringIOWrapper", ",", "self", ")", ".", "__init__", "(", "data", ")", "self", ".", "line_no", "=", "line_no", "self", ".", "name", "=",...
[ 300, 4 ]
[ 310, 29 ]
python
en
['en', 'error', 'th']
False
StringIOWrapper.next
(self)
Iterator method. This method overrides base class's next method and extends the next method to count the line numbers as each line is read. :return: Line read from file.
Iterator method. This method overrides base class's next method and extends the next method to count the line numbers as each line is read.
def next(self): """ Iterator method. This method overrides base class's next method and extends the next method to count the line numbers as each line is read. :return: Line read from file. """ parent = super(StringIOWrapper, self) if getattr(parent, 'nex...
[ "def", "next", "(", "self", ")", ":", "parent", "=", "super", "(", "StringIOWrapper", ",", "self", ")", "if", "getattr", "(", "parent", ",", "'next'", ",", "None", ")", ":", "# Python 2", "line", "=", "parent", ".", "next", "(", ")", "else", ":", "...
[ 312, 4 ]
[ 327, 19 ]
python
en
['en', 'error', 'th']
False
StringIOWrapper.readline
(self, length=0)
Wrap the base class readline. :param length: :return:
Wrap the base class readline.
def readline(self, length=0): """ Wrap the base class readline. :param length: :return: """ # pylint: disable=unused-argument line = super(StringIOWrapper, self).readline() if line is not None: self.line_no += 1 return line
[ "def", "readline", "(", "self", ",", "length", "=", "0", ")", ":", "# pylint: disable=unused-argument", "line", "=", "super", "(", "StringIOWrapper", ",", "self", ")", ".", "readline", "(", ")", "if", "line", "is", "not", "None", ":", "self", ".", "line_...
[ 332, 4 ]
[ 343, 19 ]
python
en
['en', 'error', 'th']
False
ParseUntilPattern.test_suite_headers
(self)
Test that suite headers are parsed correctly. :return:
Test that suite headers are parsed correctly.
def test_suite_headers(self): """ Test that suite headers are parsed correctly. :return: """ data = '''#include "mbedtls/ecp.h" #define ECP_PF_UNKNOWN -1 /* END_HEADER */ ''' expected = '''#line 1 "test_suite_ut.function" #include "mbedtls/ecp.h" #define ECP_PF_UNK...
[ "def", "test_suite_headers", "(", "self", ")", ":", "data", "=", "'''#include \"mbedtls/ecp.h\"\n\n#define ECP_PF_UNKNOWN -1\n/* END_HEADER */\n'''", "expected", "=", "'''#line 1 \"test_suite_ut.function\"\n#include \"mbedtls/ecp.h\"\n\n#define ECP_PF_UNKNOWN -1\n'''", "stream", "=...
[ 351, 4 ]
[ 369, 43 ]
python
en
['en', 'error', 'th']
False
ParseUntilPattern.test_line_no
(self)
Test that #line is set to correct line no. in source .function file. :return:
Test that #line is set to correct line no. in source .function file.
def test_line_no(self): """ Test that #line is set to correct line no. in source .function file. :return: """ data = '''#include "mbedtls/ecp.h" #define ECP_PF_UNKNOWN -1 /* END_HEADER */ ''' offset_line_no = 5 expected = '''#line %d "test_suite_ut.function"...
[ "def", "test_line_no", "(", "self", ")", ":", "data", "=", "'''#include \"mbedtls/ecp.h\"\n\n#define ECP_PF_UNKNOWN -1\n/* END_HEADER */\n'''", "offset_line_no", "=", "5", "expected", "=", "'''#line %d \"test_suite_ut.function\"\n#include \"mbedtls/ecp.h\"\n\n#define ECP_PF_UNKNOWN ...
[ 371, 4 ]
[ 391, 43 ]
python
en
['en', 'error', 'th']
False
ParseUntilPattern.test_no_end_header_comment
(self)
Test that InvalidFileFormat is raised when end header comment is missing. :return:
Test that InvalidFileFormat is raised when end header comment is missing. :return:
def test_no_end_header_comment(self): """ Test that InvalidFileFormat is raised when end header comment is missing. :return: """ data = '''#include "mbedtls/ecp.h" #define ECP_PF_UNKNOWN -1 ''' stream = StringIOWrapper('test_suite_ut.function', data) ...
[ "def", "test_no_end_header_comment", "(", "self", ")", ":", "data", "=", "'''#include \"mbedtls/ecp.h\"\n\n#define ECP_PF_UNKNOWN -1\n\n'''", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.function'", ",", "data", ")", "self", ".", "assertRaises", "(", "Generato...
[ 393, 4 ]
[ 406, 43 ]
python
en
['en', 'error', 'th']
False
ParseSuiteDependencies.test_suite_dependencies
(self)
:return:
def test_suite_dependencies(self): """ :return: """ data = ''' * depends_on:MBEDTLS_ECP_C * END_DEPENDENCIES */ ''' expected = ['MBEDTLS_ECP_C'] stream = StringIOWrapper('test_suite_ut.function', data) dependencies = parse_suite_dependencies(stream) se...
[ "def", "test_suite_dependencies", "(", "self", ")", ":", "data", "=", "'''\n * depends_on:MBEDTLS_ECP_C\n * END_DEPENDENCIES\n */\n'''", "expected", "=", "[", "'MBEDTLS_ECP_C'", "]", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.function'", ",", "data", ")", "dep...
[ 414, 4 ]
[ 427, 48 ]
python
en
['en', 'error', 'th']
False
ParseSuiteDependencies.test_no_end_dep_comment
(self)
Test that InvalidFileFormat is raised when end dep comment is missing. :return:
Test that InvalidFileFormat is raised when end dep comment is missing. :return:
def test_no_end_dep_comment(self): """ Test that InvalidFileFormat is raised when end dep comment is missing. :return: """ data = ''' * depends_on:MBEDTLS_ECP_C ''' stream = StringIOWrapper('test_suite_ut.function', data) self.assertRaises(GeneratorInputError, par...
[ "def", "test_no_end_dep_comment", "(", "self", ")", ":", "data", "=", "'''\n* depends_on:MBEDTLS_ECP_C\n'''", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.function'", ",", "data", ")", "self", ".", "assertRaises", "(", "GeneratorInputError", ",", "parse_suite_...
[ 429, 4 ]
[ 439, 33 ]
python
en
['en', 'error', 'th']
False
ParseSuiteDependencies.test_dependencies_split
(self)
Test that InvalidFileFormat is raised when end dep comment is missing. :return:
Test that InvalidFileFormat is raised when end dep comment is missing. :return:
def test_dependencies_split(self): """ Test that InvalidFileFormat is raised when end dep comment is missing. :return: """ data = ''' * depends_on:MBEDTLS_ECP_C:A:B: C : D :F : G: !H * END_DEPENDENCIES */ ''' expected = ['MBEDTLS_ECP_C', 'A', 'B', 'C', 'D', 'F', 'G'...
[ "def", "test_dependencies_split", "(", "self", ")", ":", "data", "=", "'''\n * depends_on:MBEDTLS_ECP_C:A:B: C : D :F : G: !H\n * END_DEPENDENCIES\n */\n'''", "expected", "=", "[", "'MBEDTLS_ECP_C'", ",", "'A'", ",", "'B'", ",", "'C'", ",", "'D'", ",", "'F'", ",", ...
[ 441, 4 ]
[ 454, 48 ]
python
en
['en', 'error', 'th']
False
ParseFuncDependencies.test_function_dependencies
(self)
Test that parse_function_dependencies() correctly parses function dependencies. :return:
Test that parse_function_dependencies() correctly parses function dependencies. :return:
def test_function_dependencies(self): """ Test that parse_function_dependencies() correctly parses function dependencies. :return: """ line = '/* BEGIN_CASE ' \ 'depends_on:MBEDTLS_ENTROPY_NV_SEED:MBEDTLS_FS_IO */' expected = ['MBEDTLS_ENTROPY_NV_SE...
[ "def", "test_function_dependencies", "(", "self", ")", ":", "line", "=", "'/* BEGIN_CASE '", "'depends_on:MBEDTLS_ENTROPY_NV_SEED:MBEDTLS_FS_IO */'", "expected", "=", "[", "'MBEDTLS_ENTROPY_NV_SEED'", ",", "'MBEDTLS_FS_IO'", "]", "dependencies", "=", "parse_function_dependencie...
[ 462, 4 ]
[ 472, 48 ]
python
en
['en', 'error', 'th']
False
ParseFuncDependencies.test_no_dependencies
(self)
Test that parse_function_dependencies() correctly parses function dependencies. :return:
Test that parse_function_dependencies() correctly parses function dependencies. :return:
def test_no_dependencies(self): """ Test that parse_function_dependencies() correctly parses function dependencies. :return: """ line = '/* BEGIN_CASE */' dependencies = parse_function_dependencies(line) self.assertEqual(dependencies, [])
[ "def", "test_no_dependencies", "(", "self", ")", ":", "line", "=", "'/* BEGIN_CASE */'", "dependencies", "=", "parse_function_dependencies", "(", "line", ")", "self", ".", "assertEqual", "(", "dependencies", ",", "[", "]", ")" ]
[ 474, 4 ]
[ 482, 42 ]
python
en
['en', 'error', 'th']
False
ParseFuncDependencies.test_tolerance
(self)
Test that parse_function_dependencies() correctly parses function dependencies. :return:
Test that parse_function_dependencies() correctly parses function dependencies. :return:
def test_tolerance(self): """ Test that parse_function_dependencies() correctly parses function dependencies. :return: """ line = '/* BEGIN_CASE depends_on:MBEDTLS_FS_IO: A : !B:C : F*/' dependencies = parse_function_dependencies(line) self.assertEqual(dep...
[ "def", "test_tolerance", "(", "self", ")", ":", "line", "=", "'/* BEGIN_CASE depends_on:MBEDTLS_FS_IO: A : !B:C : F*/'", "dependencies", "=", "parse_function_dependencies", "(", "line", ")", "self", ".", "assertEqual", "(", "dependencies", ",", "[", "'MBEDTLS_FS_IO'", "...
[ 484, 4 ]
[ 492, 78 ]
python
en
['en', 'error', 'th']
False
ParseFuncSignature.test_int_and_char_params
(self)
Test int and char parameters parsing :return:
Test int and char parameters parsing :return:
def test_int_and_char_params(self): """ Test int and char parameters parsing :return: """ line = 'void entropy_threshold( char * a, int b, int result )' args, local, arg_dispatch = parse_function_arguments(line) self.assertEqual(args, ['char*', 'int', 'int']) ...
[ "def", "test_int_and_char_params", "(", "self", ")", ":", "line", "=", "'void entropy_threshold( char * a, int b, int result )'", "args", ",", "local", ",", "arg_dispatch", "=", "parse_function_arguments", "(", "line", ")", "self", ".", "assertEqual", "(", "args", ","...
[ 500, 4 ]
[ 511, 66 ]
python
en
['en', 'error', 'th']
False
ParseFuncSignature.test_hex_params
(self)
Test hex parameters parsing :return:
Test hex parameters parsing :return:
def test_hex_params(self): """ Test hex parameters parsing :return: """ line = 'void entropy_threshold( char * a, data_t * h, int result )' args, local, arg_dispatch = parse_function_arguments(line) self.assertEqual(args, ['char*', 'hex', 'int']) self.asse...
[ "def", "test_hex_params", "(", "self", ")", ":", "line", "=", "'void entropy_threshold( char * a, data_t * h, int result )'", "args", ",", "local", ",", "arg_dispatch", "=", "parse_function_arguments", "(", "line", ")", "self", ".", "assertEqual", "(", "args", ",", ...
[ 513, 4 ]
[ 526, 66 ]
python
en
['en', 'error', 'th']
False
ParseFuncSignature.test_unsupported_arg
(self)
Test unsupported arguments (not among int, char * and data_t) :return:
Test unsupported arguments (not among int, char * and data_t) :return:
def test_unsupported_arg(self): """ Test unsupported arguments (not among int, char * and data_t) :return: """ line = 'void entropy_threshold( char * a, data_t * h, char result )' self.assertRaises(ValueError, parse_function_arguments, line)
[ "def", "test_unsupported_arg", "(", "self", ")", ":", "line", "=", "'void entropy_threshold( char * a, data_t * h, char result )'", "self", ".", "assertRaises", "(", "ValueError", ",", "parse_function_arguments", ",", "line", ")" ]
[ 528, 4 ]
[ 534, 69 ]
python
en
['en', 'error', 'th']
False
ParseFuncSignature.test_no_params
(self)
Test no parameters. :return:
Test no parameters. :return:
def test_no_params(self): """ Test no parameters. :return: """ line = 'void entropy_threshold()' args, local, arg_dispatch = parse_function_arguments(line) self.assertEqual(args, []) self.assertEqual(local, '') self.assertEqual(arg_dispatch, [])
[ "def", "test_no_params", "(", "self", ")", ":", "line", "=", "'void entropy_threshold()'", "args", ",", "local", ",", "arg_dispatch", "=", "parse_function_arguments", "(", "line", ")", "self", ".", "assertEqual", "(", "args", ",", "[", "]", ")", "self", ".",...
[ 536, 4 ]
[ 545, 42 ]
python
en
['en', 'error', 'th']
False
ParseFunctionCode.assert_raises_regex
(self, exp, regex, func, *args)
Python 2 & 3 portable wrapper of assertRaisesRegex(p)? function. :param exp: Exception type expected to be raised by cb. :param regex: Expected exception message :param func: callable object under test :param args: variable positional arguments
Python 2 & 3 portable wrapper of assertRaisesRegex(p)? function.
def assert_raises_regex(self, exp, regex, func, *args): """ Python 2 & 3 portable wrapper of assertRaisesRegex(p)? function. :param exp: Exception type expected to be raised by cb. :param regex: Expected exception message :param func: callable object under test :param ar...
[ "def", "assert_raises_regex", "(", "self", ",", "exp", ",", "regex", ",", "func", ",", "*", "args", ")", ":", "parent", "=", "super", "(", "ParseFunctionCode", ",", "self", ")", "# Pylint does not appreciate that the super method called", "# conditionally can be avail...
[ 553, 4 ]
[ 583, 33 ]
python
en
['en', 'error', 'th']
False
ParseFunctionCode.test_no_function
(self)
Test no test function found. :return:
Test no test function found. :return:
def test_no_function(self): """ Test no test function found. :return: """ data = ''' No test function ''' stream = StringIOWrapper('test_suite_ut.function', data) err_msg = 'file: test_suite_ut.function - Test functions not found!' self.assert_raises_regex...
[ "def", "test_no_function", "(", "self", ")", ":", "data", "=", "'''\nNo\ntest\nfunction\n'''", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.function'", ",", "data", ")", "err_msg", "=", "'file: test_suite_ut.function - Test functions not found!'", "self", ".", "...
[ 585, 4 ]
[ 598, 69 ]
python
en
['en', 'error', 'th']
False
ParseFunctionCode.test_no_end_case_comment
(self)
Test missing end case. :return:
Test missing end case. :return:
def test_no_end_case_comment(self): """ Test missing end case. :return: """ data = ''' void test_func() { } ''' stream = StringIOWrapper('test_suite_ut.function', data) err_msg = r'file: test_suite_ut.function - '\ 'end case pattern .*? not found...
[ "def", "test_no_end_case_comment", "(", "self", ")", ":", "data", "=", "'''\nvoid test_func()\n{\n}\n'''", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.function'", ",", "data", ")", "err_msg", "=", "r'file: test_suite_ut.function - '", "'end case pattern .*? not fou...
[ 600, 4 ]
[ 614, 69 ]
python
en
['en', 'error', 'th']
False
ParseFunctionCode.test_function_called
(self, parse_function_arguments_mock)
Test parse_function_code() :return:
Test parse_function_code() :return:
def test_function_called(self, parse_function_arguments_mock): """ Test parse_function_code() :return: """ parse_function_arguments_mock.return_value = ([], '', []) data = ''' void test_func() { } ''' stream = StringIOWrapper('test_sui...
[ "def", "test_function_called", "(", "self", ",", "parse_function_arguments_mock", ")", ":", "parse_function_arguments_mock", ".", "return_value", "=", "(", "[", "]", ",", "''", ",", "[", "]", ")", "data", "=", "'''\nvoid test_func()\n{\n}\n'''", "stream", "=", "St...
[ 617, 4 ]
[ 633, 78 ]
python
en
['en', 'error', 'th']
False
ParseFunctionCode.test_return
(self, parse_function_arguments_mock, gen_function_wrapper_mock, gen_dependencies_mock, gen_dispatch_mock)
Test generated code. :return:
Test generated code. :return:
def test_return(self, parse_function_arguments_mock, gen_function_wrapper_mock, gen_dependencies_mock, gen_dispatch_mock): """ Test generated code. :return: """ parse_function_arguments_mock.return_value = ([], '', []) ...
[ "def", "test_return", "(", "self", ",", "parse_function_arguments_mock", ",", "gen_function_wrapper_mock", ",", "gen_dependencies_mock", ",", "gen_dispatch_mock", ")", ":", "parse_function_arguments_mock", ".", "return_value", "=", "(", "[", "]", ",", "''", ",", "[", ...
[ 639, 4 ]
[ 678, 69 ]
python
en
['en', 'error', 'th']
False
ParseFunctionCode.test_with_exit_label
(self, parse_function_arguments_mock, gen_function_wrapper_mock, gen_dependencies_mock, gen_dispatch_mock)
Test when exit label is present. :return:
Test when exit label is present. :return:
def test_with_exit_label(self, parse_function_arguments_mock, gen_function_wrapper_mock, gen_dependencies_mock, gen_dispatch_mock): """ Test when exit label is present. :return: """ parse_funct...
[ "def", "test_with_exit_label", "(", "self", ",", "parse_function_arguments_mock", ",", "gen_function_wrapper_mock", ",", "gen_dependencies_mock", ",", "gen_dispatch_mock", ")", ":", "parse_function_arguments_mock", ".", "return_value", "=", "(", "[", "]", ",", "''", ","...
[ 684, 4 ]
[ 721, 40 ]
python
en
['en', 'error', 'th']
False
ParseFunctionCode.test_non_void_function
(self)
Test invalid signature (non void). :return:
Test invalid signature (non void). :return:
def test_non_void_function(self): """ Test invalid signature (non void). :return: """ data = 'int entropy_threshold( char * a, data_t * h, int result )' err_msg = 'file: test_suite_ut.function - Test functions not found!' stream = StringIOWrapper('test_suite_ut.fu...
[ "def", "test_non_void_function", "(", "self", ")", ":", "data", "=", "'int entropy_threshold( char * a, data_t * h, int result )'", "err_msg", "=", "'file: test_suite_ut.function - Test functions not found!'", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.function'", ",", ...
[ 723, 4 ]
[ 732, 69 ]
python
en
['en', 'error', 'th']
False
ParseFunctionCode.test_functio_name_on_newline
(self, parse_function_arguments_mock, gen_function_wrapper_mock, gen_dependencies_mock, gen_dispatch_mock)
Test when exit label is present. :return:
Test when exit label is present. :return:
def test_functio_name_on_newline(self, parse_function_arguments_mock, gen_function_wrapper_mock, gen_dependencies_mock, gen_dispatch_mock): """ Test when exit label is present. :return:...
[ "def", "test_functio_name_on_newline", "(", "self", ",", "parse_function_arguments_mock", ",", "gen_function_wrapper_mock", ",", "gen_dependencies_mock", ",", "gen_dispatch_mock", ")", ":", "parse_function_arguments_mock", ".", "return_value", "=", "(", "[", "]", ",", "''...
[ 738, 4 ]
[ 781, 40 ]
python
en
['en', 'error', 'th']
False
ParseFunction.test_begin_header
(self, parse_until_pattern_mock)
Test that begin header is checked and parse_until_pattern() is called. :return:
Test that begin header is checked and parse_until_pattern() is called. :return:
def test_begin_header(self, parse_until_pattern_mock): """ Test that begin header is checked and parse_until_pattern() is called. :return: """ def stop(*_unused): """Stop when parse_until_pattern is called.""" raise Exception parse_until_pattern_mo...
[ "def", "test_begin_header", "(", "self", ",", "parse_until_pattern_mock", ")", ":", "def", "stop", "(", "*", "_unused", ")", ":", "\"\"\"Stop when parse_until_pattern is called.\"\"\"", "raise", "Exception", "parse_until_pattern_mock", ".", "side_effect", "=", "stop", "...
[ 790, 4 ]
[ 808, 43 ]
python
en
['en', 'error', 'th']
False
ParseFunction.test_begin_helper
(self, parse_until_pattern_mock)
Test that begin helper is checked and parse_until_pattern() is called. :return:
Test that begin helper is checked and parse_until_pattern() is called. :return:
def test_begin_helper(self, parse_until_pattern_mock): """ Test that begin helper is checked and parse_until_pattern() is called. :return: """ def stop(*_unused): """Stop when parse_until_pattern is called.""" raise Exception parse_until_pattern_mo...
[ "def", "test_begin_helper", "(", "self", ",", "parse_until_pattern_mock", ")", ":", "def", "stop", "(", "*", "_unused", ")", ":", "\"\"\"Stop when parse_until_pattern is called.\"\"\"", "raise", "Exception", "parse_until_pattern_mock", ".", "side_effect", "=", "stop", "...
[ 811, 4 ]
[ 831, 43 ]
python
en
['en', 'error', 'th']
False
ParseFunction.test_begin_dep
(self, parse_suite_dependencies_mock)
Test that begin dep is checked and parse_suite_dependencies() is called. :return:
Test that begin dep is checked and parse_suite_dependencies() is called. :return:
def test_begin_dep(self, parse_suite_dependencies_mock): """ Test that begin dep is checked and parse_suite_dependencies() is called. :return: """ def stop(*_unused): """Stop when parse_until_pattern is called.""" raise Exception parse_suit...
[ "def", "test_begin_dep", "(", "self", ",", "parse_suite_dependencies_mock", ")", ":", "def", "stop", "(", "*", "_unused", ")", ":", "\"\"\"Stop when parse_until_pattern is called.\"\"\"", "raise", "Exception", "parse_suite_dependencies_mock", ".", "side_effect", "=", "sto...
[ 834, 4 ]
[ 852, 43 ]
python
en
['en', 'error', 'th']
False
ParseFunction.test_begin_function_dep
(self, func_mock)
Test that begin dep is checked and parse_function_dependencies() is called. :return:
Test that begin dep is checked and parse_function_dependencies() is called. :return:
def test_begin_function_dep(self, func_mock): """ Test that begin dep is checked and parse_function_dependencies() is called. :return: """ def stop(*_unused): """Stop when parse_until_pattern is called.""" raise Exception func_mock.side_eff...
[ "def", "test_begin_function_dep", "(", "self", ",", "func_mock", ")", ":", "def", "stop", "(", "*", "_unused", ")", ":", "\"\"\"Stop when parse_until_pattern is called.\"\"\"", "raise", "Exception", "func_mock", ".", "side_effect", "=", "stop", "dependencies_str", "="...
[ 855, 4 ]
[ 875, 43 ]
python
en
['en', 'error', 'th']
False
ParseFunction.test_return
(self, func_mock1, func_mock2)
Test that begin case is checked and parse_function_code() is called. :return:
Test that begin case is checked and parse_function_code() is called. :return:
def test_return(self, func_mock1, func_mock2): """ Test that begin case is checked and parse_function_code() is called. :return: """ func_mock1.return_value = [] in_func_code = '''void test_func() { } ''' func_dispatch = ''' test_func_wrapper, ''' func...
[ "def", "test_return", "(", "self", ",", "func_mock1", ",", "func_mock2", ")", ":", "func_mock1", ".", "return_value", "=", "[", "]", "in_func_code", "=", "'''void test_func()\n{\n}\n'''", "func_dispatch", "=", "'''\n test_func_wrapper,\n'''", "func_mock2", ".", "re...
[ 879, 4 ]
[ 913, 59 ]
python
en
['en', 'error', 'th']
False
ParseFunction.test_parsing
(self)
Test case parsing. :return:
Test case parsing. :return:
def test_parsing(self): """ Test case parsing. :return: """ data = '''/* BEGIN_HEADER */ #include "mbedtls/ecp.h" #define ECP_PF_UNKNOWN -1 /* END_HEADER */ /* BEGIN_DEPENDENCIES * depends_on:MBEDTLS_ECP_C * END_DEPENDENCIES */ /* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_N...
[ "def", "test_parsing", "(", "self", ")", ":", "data", "=", "'''/* BEGIN_HEADER */\n#include \"mbedtls/ecp.h\"\n\n#define ECP_PF_UNKNOWN -1\n/* END_HEADER */\n\n/* BEGIN_DEPENDENCIES\n * depends_on:MBEDTLS_ECP_C\n * END_DEPENDENCIES\n */\n\n/* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_NV_SEED:MBEDTLS...
[ 915, 4 ]
[ 1008, 60 ]
python
en
['en', 'error', 'th']
False
ParseFunction.test_same_function_name
(self)
Test name conflict. :return:
Test name conflict. :return:
def test_same_function_name(self): """ Test name conflict. :return: """ data = '''/* BEGIN_HEADER */ #include "mbedtls/ecp.h" #define ECP_PF_UNKNOWN -1 /* END_HEADER */ /* BEGIN_DEPENDENCIES * depends_on:MBEDTLS_ECP_C * END_DEPENDENCIES */ /* BEGIN_CASE depends_on:MBEDT...
[ "def", "test_same_function_name", "(", "self", ")", ":", "data", "=", "'''/* BEGIN_HEADER */\n#include \"mbedtls/ecp.h\"\n\n#define ECP_PF_UNKNOWN -1\n/* END_HEADER */\n\n/* BEGIN_DEPENDENCIES\n * depends_on:MBEDTLS_ECP_C\n * END_DEPENDENCIES\n */\n\n/* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_NV_S...
[ 1010, 4 ]
[ 1039, 71 ]
python
en
['en', 'error', 'th']
False
EscapedSplit.test_invalid_input
(self)
Test when input split character is not a character. :return:
Test when input split character is not a character. :return:
def test_invalid_input(self): """ Test when input split character is not a character. :return: """ self.assertRaises(ValueError, escaped_split, '', 'string')
[ "def", "test_invalid_input", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "ValueError", ",", "escaped_split", ",", "''", ",", "'string'", ")" ]
[ 1050, 4 ]
[ 1055, 66 ]
python
en
['en', 'error', 'th']
False
EscapedSplit.test_empty_string
(self)
Test empty string input. :return:
Test empty string input. :return:
def test_empty_string(self): """ Test empty string input. :return: """ splits = escaped_split('', ':') self.assertEqual(splits, [])
[ "def", "test_empty_string", "(", "self", ")", ":", "splits", "=", "escaped_split", "(", "''", ",", "':'", ")", "self", ".", "assertEqual", "(", "splits", ",", "[", "]", ")" ]
[ 1057, 4 ]
[ 1063, 36 ]
python
en
['en', 'error', 'th']
False
EscapedSplit.test_no_escape
(self)
Test with no escape character. The behaviour should be same as str.split() :return:
Test with no escape character. The behaviour should be same as str.split() :return:
def test_no_escape(self): """ Test with no escape character. The behaviour should be same as str.split() :return: """ test_str = 'yahoo:google' splits = escaped_split(test_str, ':') self.assertEqual(splits, test_str.split(':'))
[ "def", "test_no_escape", "(", "self", ")", ":", "test_str", "=", "'yahoo:google'", "splits", "=", "escaped_split", "(", "test_str", ",", "':'", ")", "self", ".", "assertEqual", "(", "splits", ",", "test_str", ".", "split", "(", "':'", ")", ")" ]
[ 1065, 4 ]
[ 1073, 53 ]
python
en
['en', 'error', 'th']
False
EscapedSplit.test_escaped_input
(self)
Test input that has escaped delimiter. :return:
Test input that has escaped delimiter. :return:
def test_escaped_input(self): """ Test input that has escaped delimiter. :return: """ test_str = r'yahoo\:google:facebook' splits = escaped_split(test_str, ':') self.assertEqual(splits, [r'yahoo\:google', 'facebook'])
[ "def", "test_escaped_input", "(", "self", ")", ":", "test_str", "=", "r'yahoo\\:google:facebook'", "splits", "=", "escaped_split", "(", "test_str", ",", "':'", ")", "self", ".", "assertEqual", "(", "splits", ",", "[", "r'yahoo\\:google'", ",", "'facebook'", "]",...
[ 1075, 4 ]
[ 1082, 64 ]
python
en
['en', 'error', 'th']
False
EscapedSplit.test_escaped_escape
(self)
Test input that has escaped delimiter. :return:
Test input that has escaped delimiter. :return:
def test_escaped_escape(self): """ Test input that has escaped delimiter. :return: """ test_str = r'yahoo\\:google:facebook' splits = escaped_split(test_str, ':') self.assertEqual(splits, [r'yahoo\\', 'google', 'facebook'])
[ "def", "test_escaped_escape", "(", "self", ")", ":", "test_str", "=", "r'yahoo\\\\:google:facebook'", "splits", "=", "escaped_split", "(", "test_str", ",", "':'", ")", "self", ".", "assertEqual", "(", "splits", ",", "[", "r'yahoo\\\\'", ",", "'google'", ",", "...
[ 1084, 4 ]
[ 1091, 68 ]
python
en
['en', 'error', 'th']
False
EscapedSplit.test_all_at_once
(self)
Test input that has escaped delimiter. :return:
Test input that has escaped delimiter. :return:
def test_all_at_once(self): """ Test input that has escaped delimiter. :return: """ test_str = r'yahoo\\:google:facebook\:instagram\\:bbc\\:wikipedia' splits = escaped_split(test_str, ':') self.assertEqual(splits, [r'yahoo\\', r'google', ...
[ "def", "test_all_at_once", "(", "self", ")", ":", "test_str", "=", "r'yahoo\\\\:google:facebook\\:instagram\\\\:bbc\\\\:wikipedia'", "splits", "=", "escaped_split", "(", "test_str", ",", "':'", ")", "self", ".", "assertEqual", "(", "splits", ",", "[", "r'yahoo\\\\'", ...
[ 1093, 4 ]
[ 1102, 58 ]
python
en
['en', 'error', 'th']
False
ParseTestData.test_parser
(self)
Test that tests are parsed correctly from data file. :return:
Test that tests are parsed correctly from data file. :return:
def test_parser(self): """ Test that tests are parsed correctly from data file. :return: """ data = """ Diffie-Hellman full exchange #1 dhm_do_dhm:10:"23":10:"5" Diffie-Hellman full exchange #2 dhm_do_dhm:10:"93450983094850938450983409623":10:"9345098304850938450983409622" Diff...
[ "def", "test_parser", "(", "self", ")", ":", "data", "=", "\"\"\"\nDiffie-Hellman full exchange #1\ndhm_do_dhm:10:\"23\":10:\"5\"\n\nDiffie-Hellman full exchange #2\ndhm_do_dhm:10:\"93450983094850938450983409623\":10:\"9345098304850938450983409622\"\n\nDiffie-Hellman full exchange #3\ndhm_do_dhm:10:...
[ 1110, 4 ]
[ 1155, 38 ]
python
en
['en', 'error', 'th']
False
ParseTestData.test_with_dependencies
(self)
Test that tests with dependencies are parsed. :return:
Test that tests with dependencies are parsed. :return:
def test_with_dependencies(self): """ Test that tests with dependencies are parsed. :return: """ data = """ Diffie-Hellman full exchange #1 depends_on:YAHOO dhm_do_dhm:10:"23":10:"5" Diffie-Hellman full exchange #2 dhm_do_dhm:10:"93450983094850938450983409623":10:"93450983048509...
[ "def", "test_with_dependencies", "(", "self", ")", ":", "data", "=", "\"\"\"\nDiffie-Hellman full exchange #1\ndepends_on:YAHOO\ndhm_do_dhm:10:\"23\":10:\"5\"\n\nDiffie-Hellman full exchange #2\ndhm_do_dhm:10:\"93450983094850938450983409623\":10:\"9345098304850938450983409622\"\n\n\"\"\"", "stream...
[ 1157, 4 ]
[ 1185, 76 ]
python
en
['en', 'error', 'th']
False
ParseTestData.test_no_args
(self)
Test GeneratorInputError is raised when test function name and args line is missing. :return:
Test GeneratorInputError is raised when test function name and args line is missing. :return:
def test_no_args(self): """ Test GeneratorInputError is raised when test function name and args line is missing. :return: """ data = """ Diffie-Hellman full exchange #1 depends_on:YAHOO Diffie-Hellman full exchange #2 dhm_do_dhm:10:"93450983094850938450983409623":10:"93...
[ "def", "test_no_args", "(", "self", ")", ":", "data", "=", "\"\"\"\nDiffie-Hellman full exchange #1\ndepends_on:YAHOO\n\n\nDiffie-Hellman full exchange #2\ndhm_do_dhm:10:\"93450983094850938450983409623\":10:\"9345098304850938450983409622\"\n\n\"\"\"", "stream", "=", "StringIOWrapper", "(", ...
[ 1187, 4 ]
[ 1208, 60 ]
python
en
['en', 'error', 'th']
False
ParseTestData.test_incomplete_data
(self)
Test GeneratorInputError is raised when test function name and args line is missing. :return:
Test GeneratorInputError is raised when test function name and args line is missing. :return:
def test_incomplete_data(self): """ Test GeneratorInputError is raised when test function name and args line is missing. :return: """ data = """ Diffie-Hellman full exchange #1 depends_on:YAHOO """ stream = StringIOWrapper('test_suite_ut.function', data) e...
[ "def", "test_incomplete_data", "(", "self", ")", ":", "data", "=", "\"\"\"\nDiffie-Hellman full exchange #1\ndepends_on:YAHOO\n\"\"\"", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.function'", ",", "data", ")", "err", "=", "None", "try", ":", "for", "_", ","...
[ 1210, 4 ]
[ 1226, 60 ]
python
en
['en', 'error', 'th']
False
GenDepCheck.test_gen_dep_check
(self)
Test that dependency check code generated correctly. :return:
Test that dependency check code generated correctly. :return:
def test_gen_dep_check(self): """ Test that dependency check code generated correctly. :return: """ expected = """ case 5: { #if defined(YAHOO) ret = DEPENDENCY_SUPPORTED; #else ret = DEPENDENCY_NOT_SUPPORTED; #endif ...
[ "def", "test_gen_dep_check", "(", "self", ")", ":", "expected", "=", "\"\"\"\n case 5:\n {\n#if defined(YAHOO)\n ret = DEPENDENCY_SUPPORTED;\n#else\n ret = DEPENDENCY_NOT_SUPPORTED;\n#endif\n }\n break;\"\"\"", "out", "=", "...
[ 1235, 4 ]
[ 1251, 39 ]
python
en
['en', 'error', 'th']
False
GenDepCheck.test_not_defined_dependency
(self)
Test dependency with !. :return:
Test dependency with !. :return:
def test_not_defined_dependency(self): """ Test dependency with !. :return: """ expected = """ case 5: { #if !defined(YAHOO) ret = DEPENDENCY_SUPPORTED; #else ret = DEPENDENCY_NOT_SUPPORTED; #endif } brea...
[ "def", "test_not_defined_dependency", "(", "self", ")", ":", "expected", "=", "\"\"\"\n case 5:\n {\n#if !defined(YAHOO)\n ret = DEPENDENCY_SUPPORTED;\n#else\n ret = DEPENDENCY_NOT_SUPPORTED;\n#endif\n }\n break;\"\"\"", "out", ...
[ 1253, 4 ]
[ 1269, 39 ]
python
en
['en', 'error', 'th']
False
GenDepCheck.test_empty_dependency
(self)
Test invalid dependency input. :return:
Test invalid dependency input. :return:
def test_empty_dependency(self): """ Test invalid dependency input. :return: """ self.assertRaises(GeneratorInputError, gen_dep_check, 5, '!')
[ "def", "test_empty_dependency", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "GeneratorInputError", ",", "gen_dep_check", ",", "5", ",", "'!'", ")" ]
[ 1271, 4 ]
[ 1276, 69 ]
python
en
['en', 'error', 'th']
False
GenDepCheck.test_negative_dep_id
(self)
Test invalid dependency input. :return:
Test invalid dependency input. :return:
def test_negative_dep_id(self): """ Test invalid dependency input. :return: """ self.assertRaises(GeneratorInputError, gen_dep_check, -1, 'YAHOO')
[ "def", "test_negative_dep_id", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "GeneratorInputError", ",", "gen_dep_check", ",", "-", "1", ",", "'YAHOO'", ")" ]
[ 1278, 4 ]
[ 1283, 74 ]
python
en
['en', 'error', 'th']
False
GenExpCheck.test_gen_exp_check
(self)
Test that expression check code generated correctly. :return:
Test that expression check code generated correctly. :return:
def test_gen_exp_check(self): """ Test that expression check code generated correctly. :return: """ expected = """ case 5: { *out_value = YAHOO; } break;""" out = gen_expression_check(5, 'YAHOO') self.ass...
[ "def", "test_gen_exp_check", "(", "self", ")", ":", "expected", "=", "\"\"\"\n case 5:\n {\n *out_value = YAHOO;\n }\n break;\"\"\"", "out", "=", "gen_expression_check", "(", "5", ",", "'YAHOO'", ")", "self", ".", "assertEq...
[ 1292, 4 ]
[ 1304, 39 ]
python
en
['en', 'error', 'th']
False
GenExpCheck.test_invalid_expression
(self)
Test invalid expression input. :return:
Test invalid expression input. :return:
def test_invalid_expression(self): """ Test invalid expression input. :return: """ self.assertRaises(GeneratorInputError, gen_expression_check, 5, '')
[ "def", "test_invalid_expression", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "GeneratorInputError", ",", "gen_expression_check", ",", "5", ",", "''", ")" ]
[ 1306, 4 ]
[ 1311, 75 ]
python
en
['en', 'error', 'th']
False
GenExpCheck.test_negative_exp_id
(self)
Test invalid expression id. :return:
Test invalid expression id. :return:
def test_negative_exp_id(self): """ Test invalid expression id. :return: """ self.assertRaises(GeneratorInputError, gen_expression_check, -1, 'YAHOO')
[ "def", "test_negative_exp_id", "(", "self", ")", ":", "self", ".", "assertRaises", "(", "GeneratorInputError", ",", "gen_expression_check", ",", "-", "1", ",", "'YAHOO'", ")" ]
[ 1313, 4 ]
[ 1319, 38 ]
python
en
['en', 'error', 'th']
False
WriteDependencies.test_no_test_dependencies
(self)
Test when test dependencies input is empty. :return:
Test when test dependencies input is empty. :return:
def test_no_test_dependencies(self): """ Test when test dependencies input is empty. :return: """ stream = StringIOWrapper('test_suite_ut.data', '') unique_dependencies = [] dep_check_code = write_dependencies(stream, [], unique_dependencies) self.assertEq...
[ "def", "test_no_test_dependencies", "(", "self", ")", ":", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.data'", ",", "''", ")", "unique_dependencies", "=", "[", "]", "dep_check_code", "=", "write_dependencies", "(", "stream", ",", "[", "]", ",", "uniqu...
[ 1327, 4 ]
[ 1337, 47 ]
python
en
['en', 'error', 'th']
False
WriteDependencies.test_unique_dep_ids
(self)
:return:
def test_unique_dep_ids(self): """ :return: """ stream = StringIOWrapper('test_suite_ut.data', '') unique_dependencies = [] dep_check_code = write_dependencies(stream, ['DEP3', 'DEP2', 'DEP1'], unique_dependencies) expe...
[ "def", "test_unique_dep_ids", "(", "self", ")", ":", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.data'", ",", "''", ")", "unique_dependencies", "=", "[", "]", "dep_check_code", "=", "write_dependencies", "(", "stream", ",", "[", "'DEP3'", ",", "'DEP2'...
[ 1339, 4 ]
[ 1378, 65 ]
python
en
['en', 'error', 'th']
False
WriteDependencies.test_dep_id_repeat
(self)
:return:
def test_dep_id_repeat(self): """ :return: """ stream = StringIOWrapper('test_suite_ut.data', '') unique_dependencies = [] dep_check_code = '' dep_check_code += write_dependencies(stream, ['DEP3', 'DEP2'], unique_depen...
[ "def", "test_dep_id_repeat", "(", "self", ")", ":", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.data'", ",", "''", ")", "unique_dependencies", "=", "[", "]", "dep_check_code", "=", "''", "dep_check_code", "+=", "write_dependencies", "(", "stream", ",", ...
[ 1380, 4 ]
[ 1425, 76 ]
python
en
['en', 'error', 'th']
False
WriteParams.test_no_params
(self)
Test with empty test_args :return:
Test with empty test_args :return:
def test_no_params(self): """ Test with empty test_args :return: """ stream = StringIOWrapper('test_suite_ut.data', '') unique_expressions = [] expression_code = write_parameters(stream, [], [], unique_expressions) self.assertEqual(len(unique_expressions),...
[ "def", "test_no_params", "(", "self", ")", ":", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.data'", ",", "''", ")", "unique_expressions", "=", "[", "]", "expression_code", "=", "write_parameters", "(", "stream", ",", "[", "]", ",", "[", "]", ",", ...
[ 1433, 4 ]
[ 1443, 49 ]
python
en
['en', 'error', 'th']
False
WriteParams.test_no_exp_param
(self)
Test when there is no macro or expression in the params. :return:
Test when there is no macro or expression in the params. :return:
def test_no_exp_param(self): """ Test when there is no macro or expression in the params. :return: """ stream = StringIOWrapper('test_suite_ut.data', '') unique_expressions = [] expression_code = write_parameters(stream, ['"Yahoo"', '"abcdef00"', ...
[ "def", "test_no_exp_param", "(", "self", ")", ":", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.data'", ",", "''", ")", "unique_expressions", "=", "[", "]", "expression_code", "=", "write_parameters", "(", "stream", ",", "[", "'\"Yahoo\"'", ",", "'\"ab...
[ 1445, 4 ]
[ 1459, 65 ]
python
en
['en', 'error', 'th']
False
WriteParams.test_hex_format_int_param
(self)
Test int parameter in hex format. :return:
Test int parameter in hex format. :return:
def test_hex_format_int_param(self): """ Test int parameter in hex format. :return: """ stream = StringIOWrapper('test_suite_ut.data', '') unique_expressions = [] expression_code = write_parameters(stream, ['"Yahoo"', '"a...
[ "def", "test_hex_format_int_param", "(", "self", ")", ":", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.data'", ",", "''", ")", "unique_expressions", "=", "[", "]", "expression_code", "=", "write_parameters", "(", "stream", ",", "[", "'\"Yahoo\"'", ",", ...
[ 1461, 4 ]
[ 1475, 68 ]
python
en
['en', 'error', 'th']
False
WriteParams.test_with_exp_param
(self)
Test when there is macro or expression in the params. :return:
Test when there is macro or expression in the params. :return:
def test_with_exp_param(self): """ Test when there is macro or expression in the params. :return: """ stream = StringIOWrapper('test_suite_ut.data', '') unique_expressions = [] expression_code = write_parameters(stream, [...
[ "def", "test_with_exp_param", "(", "self", ")", ":", "stream", "=", "StringIOWrapper", "(", "'test_suite_ut.data'", ",", "''", ")", "unique_expressions", "=", "[", "]", "expression_code", "=", "write_parameters", "(", "stream", ",", "[", "'\"Yahoo\"'", ",", "'\"...
[ 1477, 4 ]
[ 1511, 36 ]
python
en
['en', 'error', 'th']
False