TST: Begin annotation notebook for risk answer key.

Read tests.risk.answer_key module into an IPython notebook, to start
a base to which answer key values and explanations can be added and
display without access to Excel.

For now, the notebook just provides the latest download link for
the spreadsheet.
This commit is contained in:
Eddie Hebert
2013-08-14 12:36:47 -04:00
parent bb8a734ae2
commit ead9fc953f
4 changed files with 81 additions and 0 deletions
+2
View File
@@ -25,3 +25,5 @@ tornado==3.1
pyparsing==2.0.1
statsmodels==0.4.3
patsy==0.1.0
Markdown==2.3.1
+49
View File
@@ -0,0 +1,49 @@
{
"metadata": {
"name": "AnswerKeyAnnotations"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": true,
"input": [
"#\n",
"# Copyright 2013 Quantopian, Inc.\n",
"#\n",
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"# you may not use this file except in compliance with the License.\n",
"# You may obtain a copy of the License at\n",
"#\n",
"# http://www.apache.org/licenses/LICENSE-2.0\n",
"#\n",
"# Unless required by applicable law or agreed to in writing, software\n",
"# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
"# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
"# See the License for the specific language governing permissions and\n",
"# limitations under the License.\n",
"\n",
"from annotation_utils import Markdown\n",
"import answer_key"
],
"language": "python",
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"Markdown(\"\"\"\n",
"Download link for latest answer key: [{latest_answer_key_url}]({latest_answer_key_url})\n",
"\"\"\".format(latest_answer_key_url=answer_key.LATEST_ANSWER_KEY_URL))"
],
"language": "python",
"outputs": []
}
]
}
]
}
+27
View File
@@ -0,0 +1,27 @@
#
# Copyright 2013 Quantopian, Inc.
#
# 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.
import markdown
# Inspired by:
# http://catherinedevlin.blogspot.com/2013/06/\
# easy-html-output-in-ipython-notebook.html
class Markdown(str):
"""
Markdown wrapper to allow dynamic Markdown cells.
"""
def _repr_html_(self):
return markdown.markdown(self)
+3
View File
@@ -44,6 +44,9 @@ ANSWER_KEY_DL_TEMPLATE = """
https://s3.amazonaws.com/zipline-test-data/risk/{md5}/risk-answer-key.xlsx
""".strip()
LATEST_ANSWER_KEY_URL = ANSWER_KEY_DL_TEMPLATE.format(
md5=ANSWER_KEY_CHECKSUMS[-1])
def answer_key_signature():
with open(ANSWER_KEY_PATH, 'r') as f: