from __future__ import absolute_import, division, print_function

from ..config import qt_client, link_function, data_factory
from glue.tests.helpers import requires_qt


@requires_qt
def test_default_clients():

    from glue.viewers.image.qt import ImageWidget
    from glue.viewers.scatter.qt import ScatterWidget
    from glue.viewers.histogram.qt import HistogramWidget

    assert ImageWidget in qt_client
    assert ScatterWidget in qt_client
    assert HistogramWidget in qt_client


def test_add_client():
    @qt_client
    class TestClient(object):
        pass

    assert TestClient in qt_client


def test_add_link_default():
    @link_function(info='maps x to y', output_labels=['y'])
    def foo(x):
        return 3
    val = (foo, 'maps x to y', ['y'])
    assert val in link_function


def test_add_data_factory():
    @data_factory('XYZ file', "*txt")
    def foo(x):
        pass
    assert (foo, 'XYZ file', '*txt', 0, False) in data_factory

@@ -758,24 +758,35 @@
 to y', %5B'y'%5D
+, 'General'
 )%0A    assert

Fix test