'Tests if widget shows error when duplicate name is entered.
And tests if widget sends None data when error is shown.
GH-2143
GH-2146'

def test_duplicate_names(self):

    table = Table('iris')
    self.send_signal(self.widget.Inputs.data, table)
    self.assertFalse(self.widget.Error.duplicate_var_name.is_shown())
    idx = self.widget.domain_view.model().index(0)
    self.widget.domain_view.setCurrentIndex(idx)
    editor = self.widget.editor_stack.findChild(ContinuousVariableEditor)
    editor.name_edit.setText('iris')
    editor.commit()
    self.widget.commit()
    self.assertTrue(self.widget.Error.duplicate_var_name.is_shown())
    output = self.get_output(self.widget.Outputs.data)
    self.assertIsNone(output)
    editor.name_edit.setText('sepal    height')
    editor.commit()
    self.widget.commit()
    self.assertFalse(self.widget.Error.duplicate_var_name.is_shown())
    output = self.get_output(self.widget.Outputs.data)
    self.assertIsInstance(output, Table)
