Skip to content

Commit

Permalink
Merge pull request #1760 from kernc/fixup
Browse files Browse the repository at this point in the history
[FIX] TimeVariable: don't crash Data Table when reloading and Visualize ...
  • Loading branch information
astaric authored Nov 18, 2016
2 parents b896110 + c9b7d0e commit 050004c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Orange/data/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ def repr_val(self, val):
return '?'
if not self.have_date and not self.have_time:
# The time is relative, unitless. The value is absolute.
return str(val)
return str(val.value) if isinstance(val, Value) else str(val)

# If you know how to simplify this, be my guest
seconds = int(val)
Expand Down
4 changes: 4 additions & 0 deletions Orange/tests/test_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,10 @@ def test_readwrite_timevariable(self):
self.assertEqual(input_csv.getvalue().splitlines(),
output_csv.getvalue().splitlines())

def test_repr_value(self):
# https://github.com/biolab/orange3/pull/1760
var = TimeVariable('time')
self.assertEqual(var.repr_val(Value(var, 416.3)), '416.3')


PickleContinuousVariable = create_pickling_tests(
Expand Down

0 comments on commit 050004c

Please sign in to comment.