-
Notifications
You must be signed in to change notification settings - Fork 86
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
schema["type"] should allow str or unicode, and the error now prints the type #96
Conversation
@mastereric You broke the tests, needs to be fixed and the linting of the changed code is not good. Both needs to be fixed before i could accept this PR. |
pykwalify/rule.py
Outdated
@@ -380,9 +380,9 @@ def init(self, schema, path): | |||
t = DEFAULT_TYPE | |||
self.type = t | |||
else: | |||
if not isinstance(schema["type"], str): | |||
if not (isinstance(schema["type"], str) or isinstance(schema["type"], unicode)): |
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.
You should glob them together into into something like
if not isinstance(schema["type"], (str, int))
and get the same logic and much cleaner code.
pykwalify/rule.py
Outdated
raise RuleError( | ||
msg=u"Key 'type' in schema rule is not a string type", | ||
msg=u"Key 'type' in schema rule is not a string type (found "+str(type(schema["type"]))+")", |
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.
Horrible python linting, should be
msg=u"Key 'type' in schema rule is not a string type (found " + str(type(schema["type"])) + ")",
Apologies for the delay in fixing your issues. I corrected the linting on my code changes, and discovered that modifying one of the error messages to be more verbose broke an assertion in one of the unit tests, which I fixed. All unit tests now pass on my machine. |
1 similar comment
@Grokzen Looking at the Travis page, it says that 2 checks failed, however there are no logs for the checks that failed. All tests where there are logs show all checks have passed. Can you please fix this issue? |
@Grokzen This issue appears to have been closed without comment, can you please clarify? |
@mastereric I accidentally closed all open MR:s when i removed the destination branch. I am currently manually merging all of them including this one. |
@mastereric Manually merged the commits here 24adf3d..dfb45cb |
A fix for a frustrating bug I encountered. I'm surprised the unit tests even work.