Example #1
0
def test_remove_default_actions(global_var):
    df = pytest.car_df
    df._repr_html_()

    lux.config.remove_action("distribution")
    df._repr_html_()
    assert "Distribution" not in df.recommendation

    lux.config.remove_action("occurrence")
    df._repr_html_()
    assert "Occurrence" not in df.recommendation

    lux.config.remove_action("temporal")
    df._repr_html_()
    assert "Temporal" not in df.recommendation

    lux.config.remove_action("correlation")
    df._repr_html_()
    assert "Correlation" not in df.recommendation

    assert (
        len(df.recommendation) == 0,
        "Default actions should not be rendered after it has been removed.",
    )

    df = register_new_action()
    df.set_intent(["Acceleration", "Horsepower"])
    df._repr_html_()
    assert (
        "bars" in df.recommendation,
        "Bars should be rendered after it has been registered with correct intent.",
    )
    assert len(df.recommendation["bars"]) > 0
    df.clear_intent()

    from lux.action.default import register_default_actions

    register_default_actions()
Example #2
0
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.

# Register the commonly used modules (similar to how pandas does it: https://github.com/pandas-dev/pandas/blob/master/pandas/__init__.py)
from lux.vis.Clause import Clause
from lux.core.frame import LuxDataFrame
from lux.core.sqltable import LuxSQLTable
from lux.core.joinedsqltable import JoinedSQLTable
from lux.utils.tracing_utils import LuxTracer
from ._version import __version__, version_info
from lux._config import config
from lux._config.config import warning_format
from lux.utils.debug_utils import debug_info, check_luxwidget_enabled

from lux._config import Config

config = Config()

from lux.action.default import register_default_actions

register_default_actions()
check_luxwidget_enabled()