From: Greg Wilson Date: Wed, 21 Aug 2013 01:11:58 +0000 (-0400) Subject: Many files meant to be used as includes had somehow been transformed X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6e92320f4cfe41c2e3b5ed27c430fcf50d531283;p=swc-testing-nose.git Many files meant to be used as includes had somehow been transformed into standalone HTML files. The extra header and footer boilerplate has been removed, and single-quoted attributes have been turned into proper double-quoted attributes. W. Trevor King: I dropped everything from the original 6a4f3fb except for the LICENSE.md and lessons/swc-python/ears.py additions. I also added a blank line to Greg's commit message for cleaner 'git log --oneline' formatting. Conflicts: _includes/banner.html _includes/bootcamps/contact.html _includes/bootcamps/eventbrite.html _includes/bootcamps/instructors.html _includes/bootcamps/python.html _includes/bootcamps/r.html _includes/bootcamps/requirements.html _includes/bootcamps/what.html _includes/bootcamps/who.html _includes/footer.html _includes/guide-db/aggregate/challenges.html _includes/guide-db/aggregate/challenges/average-null.html _includes/guide-db/aggregate/challenges/concat.html _includes/guide-db/aggregate/challenges/count-ave-temp.html _includes/guide-db/aggregate/challenges/diff-with-average.html _includes/guide-db/aggregate/keypoints.html _includes/guide-db/aggregate/lesson.html _includes/guide-db/calc/challenges.html _includes/guide-db/calc/challenges/adjust-salinity.html _includes/guide-db/calc/challenges/missing-units.html _includes/guide-db/calc/challenges/union.html _includes/guide-db/calc/challenges/unique-major-site-ids.html _includes/guide-db/calc/keypoints.html _includes/guide-db/calc/lesson.html _includes/guide-db/create/challenges.html _includes/guide-db/create/challenges/dump-version-control.html _includes/guide-db/create/challenges/insert-olmstead.html _includes/guide-db/create/challenges/replace-null.html _includes/guide-db/create/keypoints.html _includes/guide-db/create/lesson.html _includes/guide-db/distinct/challenges.html _includes/guide-db/distinct/challenges/distinct-dates.html _includes/guide-db/distinct/challenges/distinct-vs-sort-uniq.html _includes/guide-db/distinct/keypoints.html _includes/guide-db/distinct/lesson.html _includes/guide-db/filter/challenges.html _includes/guide-db/filter/challenges/fix-selection.html _includes/guide-db/filter/challenges/out-of-range.html _includes/guide-db/filter/challenges/select-like.html _includes/guide-db/filter/keypoints.html _includes/guide-db/filter/lesson.html _includes/guide-db/grouping/challenges/date-range.html _includes/guide-db/grouping/challenges/simplify-query.html _includes/guide-db/grouping/challenges/trace-pipeline.html --- 6e92320f4cfe41c2e3b5ed27c430fcf50d531283 diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..f17e37a --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,69 @@ +Licenses +======== + +Instructional Material +---------------------- + +All Software Carpentry instructional material is made available under +the Creative Commons Attribution license. You are free: + +* to **Share**---to copy, distribute and transmit the work +* to **Remix**---to adapt the work + +Under the following conditions: + +* **Attribution**---You must attribute the work using "Copyright (c) + Software Carpentry" (but not in any way that suggests that we + endorse you or your use of the work). Where practical, you must + also include a hyperlink to http://software-carpentry.org. + +With the understanding that: + +* **Waiver**---Any of the above conditions can be waived if you get + permission from the copyright holder. +* **Other Rights**---In no way are any of the following rights + affected by the license: + * Your fair dealing or fair use rights; + * The author's moral rights; + * Rights other persons may have either in the work itself or in + how the work is used, such as publicity or privacy rights. * +* **Notice**---For any reuse or distribution, you must make clear to + others the license terms of this work. The best way to do this is + with a link to + [http://creativecommons.org/licenses/by/3.0/](http://creativecommons.org/licenses/by/3.0/). + +For the full legal text of this license, please see +[http://creativecommons.org/licenses/by/3.0/legalcode](http://creativecommons.org/licenses/by/3.0/legalcode). + +Software +-------- + +Except where otherwise noted, the example programs and other software +provided by Software Carpentry are made available under the +[OSI](http://opensource.org)-approved +[MIT license](http://opensource.org/licenses/mit-license.html). + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Trademark +--------- + +"Software Carpentry" and the Software Carpentry logo are registered +trademarks of Software Carpentry, Ltd. diff --git a/lessons/swc-python/ears.py b/lessons/swc-python/ears.py new file mode 100644 index 0000000..fbdb130 --- /dev/null +++ b/lessons/swc-python/ears.py @@ -0,0 +1,77 @@ +""" +ears.py : a simple unit testing library for teaching in the IPython Notebook. + +ears.run() looks for all the functions defined in the calling stack frame +(hopefully the top level interpreter session) whose names begin with the +characters 'test_' and calls them in an undetermined order, collecting and +reporting results. + +Usage: + + import ears + + def test_pass(): pass + def test_fail(): assert False, 'Error message' + def test_error(): 1/0 # zero division error + + ears.run() +""" + +import sys +import inspect +import traceback + +def run(): + """ + Look for test functions defined by caller, execute, and report. + """ + # Collect functions defined in calling context. + caller_defs = inspect.stack()[1][0].f_globals + test_functions = dict([(n, caller_defs[n]) for n in caller_defs + if n.startswith('test_') and callable(caller_defs[n])]) + setup = caller_defs.get('setup', None) + teardown = caller_defs.get('teardown', None) + + # Execute and record. + passes = [] + fails = [] + errors = [] + for (name, test) in test_functions.iteritems(): + if setup is not None: + setup() + try: + test() + passes.append((name, None)) + sys.stdout.write('.') + except AssertionError as e: + fails.append((name, traceback.format_exc())) + sys.stdout.write('f') + except Exception as e: + errors.append((name, traceback.format_exc())) + sys.stdout.write('E') + if teardown is not None: + teardown() + + # Report. + print + print '{0} pass, {1} fail, {2} error'.format(len(passes), + len(fails), + len(errors)) + for (title, group) in (('fail', fails), + ('error', errors)): + for (name, exc) in group: + print '{0}\n{1}: {2}'.format('-'*40, title, name) + print exc + +if __name__ == '__main__': + + def test_pass(): + pass + + def test_fail(): + assert False, 'Error message' + + def test_error(): + 1/0 + + run()