Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new groovy big ints tests #6664

Merged
merged 5 commits into from
Jan 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions test/notebooks/groovy/BigIntsTest.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Large Integers in Tables and Autotranslation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"JSON has a problem when integers get larger than 10<sup>16</sup>\n",
"because JavaScript uses floating point for all its numbers.\n",
"Most languages, including Python, R, and the JVM languages like Groovy can easily handle integers up to 10<sup>19</sup>,\n",
"and sometimes larger.\n",
"\n",
"Numbers this large are useful for measuring time in nanoseconds, for example.\n",
"\n",
"BeakerX table and plot widgets have special support 64-bit and arbitrary precision values. Run these cells, then over over the columns to see their types."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 64-bit Longs"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def millis = 1234567890L\n",
"def nanos = millis * 1000 * 1000L\n",
"\n",
"table = [[time: nanos + 7 * 1, next_time:(nanos + 77) * 1, temp:14.6],\n",
" [time: nanos + 7 * 2, next_time:(nanos + 88) * 2, temp:18.1],\n",
" [time: nanos + 7 * 3, next_time:(nanos + 99) * 3, temp:23.6]]\n",
"\n",
"beakerx.table_with_longs = table\n",
"table"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## BigNums (arbitrary precision)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def millis = 1987654321g\n",
"// the \"g\" makes this a bignum, with as many bits as needed\n",
"def nanos = millis * 1000 * 1000g\n",
"\n",
"table = [[time: nanos + 7 * 1, next_time:(nanos + 77) * 777, temp:3.351],\n",
" [time: nanos + 7 * 2, next_time:(nanos + 88) * 888, temp:2.355],\n",
" [time: nanos + 7 * 3, next_time:(nanos + 99) * 999, temp:2.728]]\n",
"\n",
"beakerx.table_with_big_integers = table\n",
"table"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Groovy",
"language": "groovy",
"name": "groovy"
},
"language_info": {
"codemirror_mode": "groovy",
"file_extension": ".groovy",
"mimetype": "",
"name": "Groovy",
"nbconverter_exporter": "",
"version": "2.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
109 changes: 17 additions & 92 deletions test/notebooks/python/EasyFormPythonTest.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "35f1f06867894e3e938f4e4cdc1c8386",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"data": {},
"metadata": {},
"output_type": "display_data"
}
Expand All @@ -30,14 +23,7 @@
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a02cd7466a1d4ac89bf02ae4a9048d55",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"data": {},
"metadata": {},
"output_type": "display_data"
}
Expand All @@ -54,14 +40,7 @@
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "997ae0d6cb834b169919560ca90d5023",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"data": {},
"metadata": {},
"output_type": "display_data"
}
Expand All @@ -78,14 +57,7 @@
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "c004ddfe1e2542a3b75a3f8de0888ca0",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"data": {},
"metadata": {},
"output_type": "display_data"
}
Expand All @@ -102,14 +74,7 @@
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e61d7363fda648ddb77e4e32ec7decd5",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"data": {},
"metadata": {},
"output_type": "display_data"
}
Expand All @@ -126,14 +91,7 @@
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b14eba3bb65e43f2aadb755248504dcd",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"data": {},
"metadata": {},
"output_type": "display_data"
}
Expand All @@ -150,14 +108,7 @@
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "aed4ed61413e48aea8af51235573a081",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"data": {},
"metadata": {},
"output_type": "display_data"
}
Expand All @@ -174,14 +125,7 @@
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "59628ec366ef4a6e927b2a631a50c373",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"data": {},
"metadata": {},
"output_type": "display_data"
}
Expand All @@ -198,14 +142,7 @@
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "cc965ad2170a42259b51fdba04df524e",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"data": {},
"metadata": {},
"output_type": "display_data"
}
Expand All @@ -222,14 +159,7 @@
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "328bc62f5c854358951d4d9f75b70ab1",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"data": {},
"metadata": {},
"output_type": "display_data"
}
Expand Down Expand Up @@ -266,14 +196,7 @@
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e9ef16082ea44e54978651b5d3888ad0",
"version_major": 2,
"version_minor": 0
},
"method": "display_data"
},
"data": {},
"metadata": {},
"output_type": "display_data"
}
Expand All @@ -290,7 +213,9 @@
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [
""
]
}
],
"metadata": {
Expand All @@ -303,7 +228,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"version": 3.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
Expand All @@ -314,5 +239,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
}
"nbformat_minor": 0
}
13 changes: 13 additions & 0 deletions test/tests/beakerx.po.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,18 @@ var BeakerXPageObject = function () {
expect(resultTest).toMatch(expectedText);
}

this.getTableColumnLabel = function(tableIndex, columnIndex){
var table = $$("div.dataTables_scrollHead") [tableIndex];
var tableColumnLabels = table.$$("span.header-text");
return tableColumnLabels[columnIndex];
}

this.getTableCell = function(tableIndex, rowIndex, columnIndex){
var table = $$("div.dataTables_scrollBody") [tableIndex];
var tableRows = table.$$("tbody tr");
var rowCells = tableRows[rowIndex].$$("td");
return rowCells[columnIndex];
}

};
module.exports = BeakerXPageObject;
Loading