Skip to content

Commit

Permalink
#6837 - python init cells (#6866)
Browse files Browse the repository at this point in the history
* create test notebook

* #6837 add tests

* #6837 typo

* #6837 add newline
  • Loading branch information
wojciechowskim authored and scottdraves committed Feb 15, 2018
1 parent fa027d6 commit 63f9647
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/ipynb/python/InitCellsTest.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import time\n",
"print(time.strftime(\"%a %b %d %Y\"))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
41 changes: 41 additions & 0 deletions test/js/python/initCellsPythonTest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2017 TWO SIGMA OPEN SOURCE, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* 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.
*/

var BeakerXPageObject = require('../beakerx.po.js');
var beakerxPO;

describe('(Python) Testing of init cells', function() {
beforeAll(function () {
beakerxPO = new BeakerXPageObject();
beakerxPO.runNotebookByUrl('/test/ipynb/python/InitCellsTest.ipynb');
}, 2);

afterAll(function () {
beakerxPO.closeAndHaltNotebook();
});

var cellIndex;

describe('Init cells', function() {
it('(Python) Init cells display correct output', function(){
cellIndex = 0;
var codeCell = beakerxPO.runCodeCellByIndex(cellIndex);
var currentDate = Date().split(' ').slice(0, 4).join(' ');

expect(codeCell.$('div.output_subarea').getText()).toBe(currentDate);
});
})
});

0 comments on commit 63f9647

Please sign in to comment.