From c72b1ea03433280add94e4a325488b2fcd5c89bb Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Wed, 24 Oct 2012 16:42:31 -0700 Subject: [PATCH] Adding day 2 software engineering stuff to repo. --- 4-SoftwareEngineering/TestingDemos.ipynb | 199 +++++++++++++++++++++++ 4-SoftwareEngineering/animals.py | 45 +++++ 4-SoftwareEngineering/argv | 3 + 4-SoftwareEngineering/meananimals | 12 ++ 4-SoftwareEngineering/test_animals.py | 75 +++++++++ 5 files changed, 334 insertions(+) create mode 100644 4-SoftwareEngineering/TestingDemos.ipynb create mode 100644 4-SoftwareEngineering/animals.py create mode 100755 4-SoftwareEngineering/argv create mode 100755 4-SoftwareEngineering/meananimals create mode 100644 4-SoftwareEngineering/test_animals.py diff --git a/4-SoftwareEngineering/TestingDemos.ipynb b/4-SoftwareEngineering/TestingDemos.ipynb new file mode 100644 index 0000000..2e7e951 --- /dev/null +++ b/4-SoftwareEngineering/TestingDemos.ipynb @@ -0,0 +1,199 @@ +{ + "metadata": { + "name": "TestingDemos" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "code", + "collapsed": false, + "input": [ + "ls" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\u001b[34mDebugging\u001b[m\u001b[m/ TestingDemos.ipynb dev_notes.rst merida_animals.txt\r\n", + "\u001b[34mDocumentation\u001b[m\u001b[m/ animals.py dingwall_animals.txt\r\n", + "README.rst animals.txt fergus_animals.txt\r\n", + "\u001b[34mTesting\u001b[m\u001b[m/ big_animals.txt macguffin_animals.txt\r\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import animals" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "animals.read_animals('animals.txt')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "pyout", + "prompt_number": 3, + "text": [ + "(['2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23'],\n", + " ['21:06', '14:12', '10:24', '20:08', '18:46'],\n", + " ['Grizzly', 'Elk', 'Elk', 'Wolverine', 'Muskox'],\n", + " ['36', '25', '26', '31', '20'])" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "sum([1, 2, 3, 4])" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "pyout", + "prompt_number": 4, + "text": [ + "10" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import asciitable" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "asciitable.__file__" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "pyout", + "prompt_number": 6, + "text": [ + "'/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/asciitable/__init__.pyc'" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "asciitable.read('animals.txt')" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "pyout", + "prompt_number": 7, + "text": [ + "rec.array([('2011-04-22', '21:06', 'Grizzly', 36),\n", + " ('2011-04-23', '14:12', 'Elk', 25),\n", + " ('2011-04-23', '10:24', 'Elk', 26),\n", + " ('2011-04-23', '20:08', 'Wolverine', 31),\n", + " ('2011-04-23', '18:46', 'Muskox', 20)], \n", + " dtype=[('col1', '|S10'), ('col2', '|S5'), ('col3', '|S9'), ('col4', '