Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: partial replacement for string with length #383

Merged

Conversation

cgarmor
Copy link
Contributor

@cgarmor cgarmor commented Mar 21, 2024

from the dataset code it seems that support for [STRING_WITH_LENGTH_NN] inside a longer string was inteded to be supported, but the implementation does not work. This is a fix as it might be a useful feature (e.g.: for composing parameters that require a determined substring + having a given length)

seed, length = param[1:-1].split('_ARRAY_WITH_LENGTH_')
new_param = list(seeds[seed] for x in range(int(length)))
param_replaced = True
elif 'JSON_WITH_LENGTH_' in param:
length = int(param[1:-1].split('JSON_WITH_LENGTH_')[1])
new_param = dict((str(x), str(x)) for x in range(length))
param_replaced = True
elif any(x in param for x in ['STRING_WITH_LENGTH_', 'INTEGER_WITH_LENGTH_']):
seeds = {'STRING': 'a', 'INTEGER': '1'}
# The chain to be generated can be just a part of param
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could not be because we are inside an if that checks that param starts and ends with []

@cgarmor cgarmor force-pushed the fix_partial_replacement_string_with_length branch from 704dabc to 143bb31 Compare March 21, 2024 22:46
@cgarmor cgarmor force-pushed the fix_partial_replacement_string_with_length branch from 143bb31 to 12edfd3 Compare March 21, 2024 22:49
Copy link

codeclimate bot commented Mar 21, 2024

Code Climate has analyzed commit 12edfd3 and detected 0 issues on this pull request.

View more on Code Climate.

@rgonalo rgonalo merged commit 931e5ba into Telefonica:master Mar 25, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants