diff --git a/Orange/data/variable.py b/Orange/data/variable.py index 6f9c6bff026..e84bb624c59 100644 --- a/Orange/data/variable.py +++ b/Orange/data/variable.py @@ -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) diff --git a/Orange/tests/test_variable.py b/Orange/tests/test_variable.py index f650d52a6cb..2db389f892a 100644 --- a/Orange/tests/test_variable.py +++ b/Orange/tests/test_variable.py @@ -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(