# HG changeset patch # User Jeff Hammel # Date 1425168794 28800 # Node ID 07362c531a7e6587d9a27768f876ae63bc84ed69 # Parent a09d5ffd2fc9357ff3137e72b07628f0c9d26b0a stub histogram tests diff -r a09d5ffd2fc9 -r 07362c531a7e numerics/histogram.py --- a/numerics/histogram.py Sat Feb 28 14:51:10 2015 -0800 +++ b/numerics/histogram.py Sat Feb 28 16:13:14 2015 -0800 @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- """ +Histograms Unicode is awesome; see http://www.alanwood.net/unicode/block_elements.html """ @@ -34,8 +35,8 @@ def __init__(self, bins): bins = sorted(bin) assert len(bins) > 1 - self.histogram = self.OrderedDict(zip(bins[:-1], - bins[1:])) + self.data = self.OrderedDict(zip(bins[:-1], + bins[1:])) def __iadd__(self, value): return self diff -r a09d5ffd2fc9 -r 07362c531a7e tests/test_histogram.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_histogram.py Sat Feb 28 16:13:14 2015 -0800 @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +unit tests for histograms +""" + +import os +import sys +import unittest +from numerics.histogram import Histogram + +# globals +here = os.path.dirname(os.path.abspath(__file__)) + +class HistogramUnitTest(unittest.TestCase): + + def test_histogram(self): + """basic histogram test""" + + # make some test data + data = [0,0,1,1,2,3,4,5,6,7,8,8,8] + bins = range(0,10) + + # make a histogram + h = Histogram(bins) + +if __name__ == '__main__': + unittest.main() +