def test_select_x():
    def _check(data, expected):
        v = api.Viz(data)
        v.select_x()
        assert v.encoding.x.name == expected

    data = dict(col1=[1.0, 2.0, 3.0],  # Q
                col2=['A', 'B', 'C'],  # N
                col3=pd.date_range('2012', periods=3, freq='A'),  # T
                col4=pd.date_range('2012', periods=3, freq='A'))  # T
    _check(data, 'col3')

    data = dict(col1=[1.0, 2.0, 3.0],  # Q
                col2=['A', 'B', 'C'],  # N
                col3=['A', 'B', 'C'])  # N
    _check(data, 'col2')

    data = dict(col1=[1.0, 2.0, 3.0],  # Q
                col2=np.arange(3))     # Q
    _check(data, 'col1')

    # No data
    with pytest.raises(AssertionError):
        v = api.Viz(None)
        v.select_x()

    # Empty data
    with pytest.raises(AssertionError):
        v = api.Viz(dict())
        v.select_x()

    # Custom order
    data = dict(col1=[1.0, 2.0, 3.0],  # Q
                col2=['A', 'B', 'C'],  # N
                col3=pd.date_range('2012', periods=3, freq='A'),  # T
                col4=pd.date_range('2012', periods=3, freq='A'))  # T
    v = api.Viz(data)
    v.select_x(['N', 'T', 'Q', 'O'])
    assert v.encoding.x.name in 'col2'
dataset/ETHPy150Open ellisonbg/altair/altair/tests/test_api.py/test_select_x/operator `==` -> `in`