#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc.  Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see http://www.gnu.org/licenses.
#
# http://numenta.org/licenses/
# ----------------------------------------------------------------------

import unittest

from fluent.cept import Cept

class TestCept(unittest.TestCase):

  def testGetBitmap(self):
    """ Type check what we get back from the cept object """
    cept = Cept()
    response = cept.getBitmap("fox")

    self.assertTrue(type(response), 'dict')
    self.assertTrue(type(response['positions']), 'list')
    self.assertTrue(type(response['sparsity']), 'float')
    self.assertTrue(type(response['width']), 'int')
    self.assertTrue(type(response['height']), 'int')


  def testGetClosestStrings(self):
    """ Type check """
    cept = Cept()
    response = cept.getBitmap("snake")

    result = cept.getClosestStrings(response['positions'])
    self.assertTrue(type(result), 'list')


if __name__ == '__main__':
  unittest.main()

@@ -1080,17 +1080,16 @@
 tCase):%0A
-%0A
   def te
@@ -1235,33 +1235,113 @@
  self.assert
-True(type
+LessEqual(set((%22width%22, %22positions%22, %22sparsity%22, %22height%22)),%0A                         set
 (response), 
@@ -1342,17 +1342,10 @@
 nse)
-, 'dict'
 )
+%0A
 %0A   
@@ -1352,32 +1352,33 @@
  self.assert
-True(typ
+IsInstanc
 e(response%5B'
@@ -1388,25 +1388,55 @@
 itions'%5D
-)
 , 
-'
 list
-'
+, %22Positions field is not a list%22
 )%0A    se
@@ -1440,32 +1440,33 @@
  self.assert
-True(typ
+IsInstanc
 e(response%5B'
@@ -1479,18 +1479,47 @@
 ty'%5D
-)
 , 
-'
 float
-'
+, %22Sparsity field is not a list%22
 )%0A  
@@ -1527,32 +1527,33 @@
  self.assert
-True(typ
+IsInstanc
 e(response%5B'
@@ -1559,24 +1559,50 @@
 'width'%5D
-)
 , 
-'int'
+int, %22Width field is not an int%22
 )%0A    se
@@ -1606,32 +1606,33 @@
  self.assert
-True(typ
+IsInstanc
 e(response%5B'
@@ -1643,16 +1643,43 @@
 ht'%5D
-)
 , 
-'
 int
-'
+, %22Height field is not an int%22
 )%0A%0A%0A

check dict keys more idiomatically