Repository: biolab/orange3

Issue:
OWSieve: strange tooltip
<!--
This is an issue template. Please fill in the relevant details in the
sections below.

Wrap code and verbatim terminal window output into triple backticks, see:
https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code

If you're raising an issue about an add-on (e.g. installed via
Options > Add-ons), raise an issue on the relevant add-on's issue
tracker instead. See: https://github.com/biolab?q=orange3
-->

##### Orange version
<!-- From menu _Help→About→Version_ or code `Orange.version.full_version` -->
3.18

##### Expected behavior
Tooltip in Sieve Diagram says: "thal = reversable defect".


##### Actual behavior
Tooltip in Sieve Diagram says: "thal in reversable defect". This makes no sense.


##### Steps to reproduce the behavior
File (heart_disease or any data actually) - Sieve Diagram (use tooltip).

<img width="548" alt="screen shot 2019-02-04 at 14 26 42" src="https://user-images.githubusercontent.com/12524972/52211213-821bc780-2889-11e9-9f3d-8081753d80ed.png">



##### Additional info (worksheets, data, screenshots, ...)
Actually, testing this, sometimes Sieve returns "in" for tooltip and sometimes "=".  I don't know what this is about.




Discussion:

Resolving patch:
diff --git a/Orange/widgets/visualize/owsieve.py b/Orange/widgets/visualize/owsieve.py
--- a/Orange/widgets/visualize/owsieve.py
+++ b/Orange/widgets/visualize/owsieve.py
@@ -401,34 +401,30 @@ def make_tooltip():
             the enclosing scope."""
             # pylint: disable=undefined-loop-variable
             def _oper(attr, txt):
-                if self.data.domain[attr.name] is ddomain[attr.name]:
-                    return "="
+                if self.data.domain[attr.name] == ddomain[attr.name]:
+                    return " = "
                 return " " if txt[0] in "<≥" else " in "
 
-            return (
-                "<b>{attr_x}{xeq}{xval_name}</b>: {obs_x}/{n} ({p_x:.0f} %)".
-                format(attr_x=to_html(attr_x.name),
-                       xeq=_oper(attr_x, xval_name),
-                       xval_name=to_html(xval_name),
-                       obs_x=fmt(chi.probs_x[x] * n),
-                       n=int(n),
-                       p_x=100 * chi.probs_x[x]) +
-                "<br/>" +
-                "<b>{attr_y}{yeq}{yval_name}</b>: {obs_y}/{n} ({p_y:.0f} %)".
-                format(attr_y=to_html(attr_y.name),
-                       yeq=_oper(attr_y, yval_name),
-                       yval_name=to_html(yval_name),
-                       obs_y=fmt(chi.probs_y[y] * n),
-                       n=int(n),
-                       p_y=100 * chi.probs_y[y]) +
-                "<hr/>" +
-                """<b>combination of values: </b><br/>
+            xt, yt = ["<b>{attr}{eq}{val_name}</b>: {obs}/{n} ({p:.0f} %)".format(
+                attr=to_html(attr.name),
+                eq=_oper(attr, val_name),
+                val_name=to_html(val_name),
+                obs=fmt(prob * n),
+                n=int(n),
+                p=100 * prob)
+                      for attr, val_name, prob in [(attr_x, xval_name, chi.probs_x[x]),
+                                                   (attr_y, yval_name, chi.probs_y[y])]]
+
+            ct = """<b>combination of values: </b><br/>
                    &nbsp;&nbsp;&nbsp;expected {exp} ({p_exp:.0f} %)<br/>
-                   &nbsp;&nbsp;&nbsp;observed {obs} ({p_obs:.0f} %)""".
-                format(exp=fmt(chi.expected[y, x]),
+                   &nbsp;&nbsp;&nbsp;observed {obs} ({p_obs:.0f} %)""".format(
+                       exp=fmt(chi.expected[y, x]),
                        p_exp=100 * chi.expected[y, x] / n,
                        obs=fmt(chi.observed[y, x]),
-                       p_obs=100 * chi.observed[y, x] / n))
+                       p_obs=100 * chi.observed[y, x] / n)
+
+            return f"{xt}<br/>{yt}<hr/>{ct}"
+
 
         for item in self.canvas.items():
             self.canvas.removeItem(item)


Test patch: