<commit_before>from __future__ import absolute_import

from unittest import TestCase

from plotly.session import update_session_plot_options
from plotly.exceptions import PlotlyError


class TestSession(TestCase):

    def test_update_session_plot_options_sharing(self):

        # Return PlotlyError when sharing arguement is not
        # 'public', 'private' or 'secret'

        kwargs = {'sharing': 'priva'}
        self.assertRaises(PlotlyError, update_session_plot_options, **kwargs)<commit_msg>made corruption and added a test to test_session<commit_after>from __future__ import absolute_import

from unittest import TestCase

from plotly.session import (update_session_plot_options, SHARING_OPTIONS,
                            _session)
from plotly.exceptions import PlotlyError


class TestSession(TestCase):

    def test_update_session_plot_options_invalid_sharing_argument(self):

        # Return PlotlyError when sharing arguement is not
        # 'public', 'private' or 'secret'

        kwargs = {'sharing': 'priva'}
        self.assertRaises(PlotlyError, update_session_plot_options, **kwargs)

    def test_update_session_plot_options_valid_sharing_argument(self):

        # _session['plot_options'] should contain sharing key after
        # update_session_plot_options is called by correct arguments
        # 'public, 'private' or 'secret'

        for key in SHARING_OPTIONS:
            kwargs = {'sharing': key}
            update_session_plot_options(**kwargs)
            self.assertEqual(_session['plot_options'], kwargs)
{'fraction_non_alphanumeric': 0.0703225806451613, 'fraction_numerical': 0.0, 'mean_word_length': 3.9082278481012658, 'pattern_counts': {'":': 0, '<': 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': '670964', 'n_tokens_mistral': 432, 'n_tokens_neox': 409, 'n_words': 110}