-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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] Variable: Fix Variable.copy for StringVariable and TimeVariable #1589
Conversation
Current coverage is 88.66% (diff: 100%)@@ master #1589 diff @@
==========================================
Files 78 78
Lines 8121 8126 +5
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 7200 7205 +5
Misses 921 921
Partials 0 0
|
@@ -1169,6 +1169,8 @@ def __getitem__(self, key): | |||
"S", (0, 0, 0)), | |||
(vartype(TimeVariable()), | |||
"T", (68, 170, 255)), | |||
(vartype(Variable), | |||
"?", (128, 128, 128)), |
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.
But isn't Variable
just a base class? Won't this open the door for certain errors to pass silently?
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.
Yes it would. I removed it.
9bbbca0
to
6aaf362
Compare
@@ -899,6 +898,12 @@ def __init__(self, *args, **kwargs): | |||
self.have_date = 0 | |||
self.have_time = 0 | |||
|
|||
def copy(self, compute_value=None): | |||
copy = super().copy(compute_value=compute_value) | |||
copy.have_data = self.have_date |
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.
*have_date
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.
Thanks. Fixed.
Due to static constructors in Variable.copy and ContinuousVariable.copy the StringVariable.copy and TimeVariable.copy used to return Variable and ContinuousVariable instances respectively. Fix this by dispatching on `type(self)`.
6aaf362
to
a5c2d26
Compare
Due to static constructors in Variable.copy and ContinuousVariable.copy
the StringVariable.copy and TimeVariable.copy used to return Variable
and ContinuousVariable instances respectively.
Fix this by dispatching on
type(self)
.Also add the missing entry for
vartype(Variable)
ingui.attributeIconDict