-
Notifications
You must be signed in to change notification settings - Fork 404
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
[WIP] fix for #226 #247
[WIP] fix for #226 #247
Conversation
Codecov Report
@@ Coverage Diff @@
## development #247 +/- ##
===============================================
- Coverage 28.77% 28.73% -0.05%
===============================================
Files 29 29
Lines 6384 6394 +10
Branches 1616 1619 +3
===============================================
Hits 1837 1837
- Misses 4391 4401 +10
Partials 156 156
Continue to review full report at Codecov.
|
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.
Mostly just a quick glance without knowing the bigger picture...
if textValue in ["false", "off"]: | ||
return "0" | ||
elif textValue in ["true", "on"]: | ||
return "1" |
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.
I would probably use a dict, though I'm not certain it is 'better'. Just keep it in mind.
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.
good idea.
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.
It has the cost of being less flexible for handling situations like if you only want some things to be case insensitive etc. But either way, it's small now and could be easily readjusted either direction in the future as needed.
src/canmatrix/arxml.py
Outdated
:param textValue: value in text like "true" | ||
:return: string for value like "1" | ||
""" | ||
textValue = textValue.lower() |
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.
textValue = textValue.lower() | |
textValue = textValue.casefold() |
https://docs.python.org/3/library/stdtypes.html#str.casefold
Though I've heard debate on their example being proper...
src/canmatrix/arxml.py
Outdated
@@ -1200,12 +1200,22 @@ def getSignals(signalarray, Bo, xmlRoot, ns, multiplexId, float_factory): | |||
newSig.addValues(1, "TRUE") | |||
newSig.addValues(0, "FALSE") | |||
|
|||
def guessValue(textValue): |
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.
I don't know where we are on this 'officially' but do we and lowerCamel
or snake_case
? I'll add this to the refactor ticket to consider.
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.
... so you preferre snake_case
. I tried to create new features in snake_case
but this time, I missed my intent
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.
Should I change the linked ticket to just state it will be 'snake_case'? I suppose that we could instead be picking an existing coding standard/checker (black, or something configurable) and that would cover many of these questions.
src/canmatrix/arxml.py
Outdated
@@ -1200,12 +1200,22 @@ def getSignals(signalarray, Bo, xmlRoot, ns, multiplexId, float_factory): | |||
newSig.addValues(1, "TRUE") | |||
newSig.addValues(0, "FALSE") | |||
|
|||
def guessValue(textValue): | |||
""" | |||
returns a numerical value for common strings. |
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.
returns a numerical value for common strings. | |
returns a numerical string for common strings. |
At least that's what it does presently.
@ebroecker, should I be a stickler for coverage? If so, go add tests... if not, merge away. :] |
@altendky |
While we should have integration tests, it would be nice for more and more test coverage to come from tests closer to the unit level. For example, for this reason and others, So, easy enough to get coverage on |
fix for missing "putSignalIntoFrame"