-
Notifications
You must be signed in to change notification settings - Fork 36
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
feat: Semantic Versioning #293
feat: Semantic Versioning #293
Conversation
Need to add FSC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, needs to pass FSC first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we forgot le and ge (less than or equal and greater than or equal
optimizely/helpers/condition.py
Outdated
def semver_equal_evaluator(self, index): | ||
""" Evaluate the given semantic version equal match target version for the user version. | ||
|
||
Args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit. Indentation is off. This needs to align with the quotes above.
|
||
self.assertRaises(Exception) | ||
|
||
def test_evalduate__returns_exception__when_user_provided_version_is_invalid9(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in evaluate through the file
Taking a closer look at evaluation. But some typos as well as docstrings need to have aligned strings. |
optimizely/helpers/condition.py
Outdated
if self.has_white_space(target): | ||
raise Exception(Errors.INVALID_ATTRIBUTE_FORMAT) | ||
|
||
if self.is_pre_release(target): | ||
target_parts = target.split(SemverType.IS_PRE_RELEASE) | ||
elif self.is_build(target): | ||
target_parts = target.split(SemverType.IS_BUILD) | ||
|
||
if target_parts: | ||
if len(target_parts) < 1: | ||
raise Exception(Errors.INVALID_ATTRIBUTE_FORMAT) | ||
target_prefix = str(target_parts[0]) | ||
target_suffix = target_parts[1:] | ||
|
||
dot_count = target_prefix.count(".") | ||
if dot_count > 2: | ||
raise Exception(Errors.INVALID_ATTRIBUTE_FORMAT) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add comments over each of these about what is being checked in the if condition?
optimizely/helpers/enums.py
Outdated
IS_PRE_RELEASE = '-' | ||
HAS_WHITE_SPACE = " " | ||
IS_BUILD = '+' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use single quotes for all strings.
@@ -379,7 +586,7 @@ def test_substring__returns_null__when_no_user_provided_value(self): | |||
|
|||
self.assertIsNone(evaluator.evaluate(0)) | |||
|
|||
def test_greater_than_int__returns_true__when_user_value_greater_than_condition_value(self,): | |||
def test_greater_than_int__returns_true__when_user_value_greater_than_condition_value(self, ): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the , and this can simply be (self)
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
Summary
This PR adds support for semantic versioning in audience evaluation.
Test plan
Added unit tests