Skip to content

Commit

Permalink
add tests for data types for TableDisplay (python) (#6696)
Browse files Browse the repository at this point in the history
  • Loading branch information
EfimovVladimir authored and scottdraves committed Jan 22, 2018
1 parent 8b2e873 commit 2e2a423
Show file tree
Hide file tree
Showing 5 changed files with 562 additions and 6 deletions.
317 changes: 317 additions & 0 deletions test/notebooks/python/TableAPIPythonTest.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,317 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ff5a93cd997a4b328da0a945a318f1e9",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from beakerx import *\n",
"\n",
"TableDisplay({\"a\":100, \"b\":200, \"c\":300})"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ac0cc4994a5e4b42a6450f3fd31c5c23",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"TableDisplay([{\"a\":1}, {\"a\":10, \"b\":20}])"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "44739125e1fe4a4e9588fe63e238c969",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"TableDisplay({\"a\":1/10, \"b\":1/20, \"c\":0.33})"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "cc64654431eb4593ac7c86513b3366c2",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"TableDisplay([{\"a\":1/10}, {\"a\":1/100, \"b\":3.12345}])"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e79bab35802f4a05be0ab016234d028d",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"TableDisplay({\"a\":'a a a', \"b\":'b b b', \"c\":'c c c'})"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "64de21cbaf8f47ca8750c56ad189e03e",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"TableDisplay([{\"a\":'a'}, {\"a\":'1a', \"b\":'2b'}])"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "05fb389e29c5407aa32e56320053d460",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"TableDisplay({\"a\":[1, 2, 3], \"b\":[10, 20, 30], \"c\":[100, 200, 300]})"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c5d1ad52fd6d4a179cba5b43c54e8ab0",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"TableDisplay([\n",
" {\"a\":[1, 2, 3]}, \n",
" {\"a\":[10, 20, 30], \"b\":[100, 200, 300]}])"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "ec30451cae454de1b332a956460cd63f",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"row1 = {\"a\":100, \"b\":200, \"c\":300}\n",
"row2 = {\"a\":1/10, \"b\":1/20, \"c\":0.33}\n",
"row3 = {\"a\":'a a a', \"b\":'b b b', \"c\":'c c c'}\n",
"row4 = {\"a\":[1, 2, 3], \"b\":[10, 20, 30], \"c\":[100, 200, 300]}\n",
"TableDisplay([row1, row2, row3, row4])"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "68294a8a625047cda4e6fe7008ac834f",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"TableDisplay({\"a\":100, \"b\":1/20, \"c\":'c c c', \"d\":[100, 200, 300]})"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f685684b3bb1428386a66a01fdc6367e",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"row1 = {\"a\":10, \"b\":1/10, \"c\":'c', \"d\":[100, 200]}\n",
"row2 = {\"a\":100, \"b\":1/20, \"c\":'c c c', \"d\":[100, 200, 300]}\n",
"TableDisplay([row1, row2])"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "fa82ef9ddd2f411db45a64086b5efef4",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"TableDisplay({10:20, 1/10:1/20, 'c':'c c c', '[100, 200]':[100, 200, 300]})"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "58fe95c025114071941c312180843d4c",
"version_major": 2,
"version_minor": 0
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"row1 = {10:10, 1/10:1/10, 'c':'c'}\n",
"row2 = {10:20, 1/10:1/20, 'c':'c c c', '[100, 200]':[100, 200, 300]}\n",
"TableDisplay([row1, row2])"
]
},
{
"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.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
9 changes: 4 additions & 5 deletions test/tests/beakerx.po.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ var BeakerXPageObject = function () {
return $$('div.code_cell')[index];
}

this.getDtContainerByIndex = function (index) {
return this.getCodeCellByIndex(index).$('div.dtcontainer');
}

this.runCodeCellByIndex = function (index) {
var codeCell = this.getCodeCellByIndex(index);
codeCell.scroll();
Expand Down Expand Up @@ -108,11 +112,6 @@ var BeakerXPageObject = function () {
plotLegendContainer.waitForEnabled();
}

this.dataTablesIsEnabled = function(dtcontainer){
var dataTables = dtcontainer.$('.dataTables_scroll');
dataTables.waitForEnabled();
}

this.runCellToGetWidgetElement = function(index){
this.kernelIdleIcon.waitForEnabled();
var codeCell = this.runCodeCellByIndex(index);
Expand Down
Loading

0 comments on commit 2e2a423

Please sign in to comment.