changeset 68:07362c531a7e

stub histogram tests
author Jeff Hammel <k0scist@gmail.com>
date Sat, 28 Feb 2015 16:13:14 -0800
parents a09d5ffd2fc9
children 5dceb1d05a29
files numerics/histogram.py tests/test_histogram.py
diffstat 2 files changed, 33 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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
--- /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()
+