'Check whether widget retrieves correct settings for annotation'

def test_annotation_settings_retrieval(self):

    widget = self.widget
    dist_names = Orange.misc.DistMatrix(np.zeros((4, 4)), self.data, axis=0)
    dist_no_names = Orange.misc.DistMatrix(np.zeros((10, 10)), axis=1)
    self.send_signal(self.widget.Inputs.distances, self.distances)
    self.assertEqual(widget.annotation, self.data.domain.class_var)
    var2 = self.data.domain[2]
    widget.annotation = var2
    self.send_signal(self.widget.Inputs.distances, dist_no_names)
    self.assertEqual(widget.annotation, 'Enumeration')
    widget.annotation = 'None'
    self.send_signal(self.widget.Inputs.distances, self.distances)
    self.assertIs(widget.annotation, var2)
    self.send_signal(self.widget.Inputs.distances, dist_no_names)
    self.assertEqual(widget.annotation, 'None')
    self.send_signal(self.widget.Inputs.distances, dist_names)
    self.assertEqual(widget.annotation, 'Name')
    widget.annotation = 'Enumeration'
    self.send_signal(self.widget.Inputs.distances, self.distances)
    self.assertIs(widget.annotation, var2)
    self.send_signal(self.widget.Inputs.distances, dist_no_names)
    self.assertEqual(widget.annotation, 'None')
    self.send_signal(self.widget.Inputs.distances, dist_names)
    self.assertEqual(widget.annotation, 'Enumeration')
    self.send_signal(self.widget.Inputs.distances, dist_no_names)
    self.assertEqual(widget.annotation, 'None')
