<commit_before>import pytest
from numpy import random, ceil
from lightning import Lightning, Visualization


class TestLightningAPIClient(object):

    @pytest.fixture(scope="module")
    def lgn(self, host):
        lgn = Lightning(host)
        lgn.create_session("test-session")
        return lgn

    def test_create_generic(self, lgn):

        series = random.randn(5, 100)
        viz = lgn.plot(data={"series": series}, type='line')

        assert isinstance(viz, Visualization)
        assert hasattr(viz, 'id')


    def test_ipython_support(self, lgn):

        lgn.ipython = True
        x = random.randn(100)
        viz = lgn.line(x)

        assert isinstance(viz, Visualization)
        assert hasattr(viz, 'id')
<commit_msg>Add test for local visualization<commit_after>import pytest
from numpy import random, ceil
from lightning import Lightning, Visualization, VisualizationLocal


class TestLightningAPIClient(object):

    @pytest.fixture(scope="module")
    def lgn(self, host):
        lgn = Lightning(host)
        lgn.create_session("test-session")
        return lgn

    def test_create_generic(self, lgn):

        series = random.randn(5, 100)
        viz = lgn.plot(data={"series": series}, type='line')

        assert isinstance(viz, Visualization)
        assert hasattr(viz, 'id')

    def test_ipython_support(self, lgn):

        lgn.ipython = True
        x = random.randn(100)
        viz = lgn.line(x)

        assert isinstance(viz, Visualization)
        assert hasattr(viz, 'id')

    def test_local_mode(self, lgn):

        lgn.local = True
        x = random.randn(100)
        viz = lgn.line(x)

        assert isinstance(viz, VisualizationLocal)
        assert hasattr(viz, 'id')

{'fraction_non_alphanumeric': 0.10699826489300174, 'fraction_numerical': 0.009832272990167727, 'mean_word_length': 2.8189845474613686, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2087991', 'n_tokens_mistral': 579, 'n_tokens_neox': 547, 'n_words': 128}