<commit_before>//
// Test saving a notebook with escaped characters
//

casper.notebook_test(function () {
    // don't use unicode with ambiguous composed/decomposed normalization
    // because the filesystem may use a different normalization than literals.
    // This causes no actual problems, but will break string comparison.
    var nbname = "has#hash and space and unicø∂e.ipynb";
    
    this.evaluate(function (nbname) {
        require(['base/js/events'], function (events) {
            IPython.notebook.notebook_name = nbname;
            IPython._save_success = IPython._save_failed = false;
            events.on('notebook_saved.Notebook', function () {
                IPython._save_success = true;
            });
            events.on('notebook_save_failed.Notebook',
                function (event, xhr, status, error) {
                    IPython._save_failed = "save failed with " + xhr.status + xhr.responseText;
            });
            IPython.notebook.save_notebook();
        });<commit_msg>test saving with problematic cell contents<commit_after>//
// Test saving a notebook with escaped characters
//

casper.notebook_test(function () {
    // don't use unicode with ambiguous composed/decomposed normalization
    // because the filesystem may use a different normalization than literals.
    // This causes no actual problems, but will break string comparison.
    var nbname = "has#hash and space and unicø∂e.ipynb";
    
    this.append_cell("s = '??'", 'code');
    
    this.thenEvaluate(function (nbname) {
        require(['base/js/events'], function (events) {
            IPython.notebook.notebook_name = nbname;
            IPython._save_success = IPython._save_failed = false;
            events.on('notebook_saved.Notebook', function () {
                IPython._save_success = true;
            });
            events.on('notebook_save_failed.Notebook',
                function (event, xhr, status, error) {
                    IPython._save_failed = "save failed with " + xhr.status + xhr.responseText;
            });
            IPython.notebook.save_notebook();
        });
{'fraction_non_alphanumeric': 0.10432330827067669, 'fraction_numerical': 0.0, 'mean_word_length': 2.3793650793650793, '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': '7131166', 'n_tokens_mistral': 603, 'n_tokens_neox': 583, 'n_words': 147}