Example #1
0
 def test_tuple(self):
     cleaned = sanitize_db_inputs(tuple(self.TEST_DATA.values()))
     self.assertEqual(len(cleaned), len(self.TEST_DATA))
     self.assertEqual(cleaned[0], 1.0)
     self.assertFalse(isinstance(cleaned[0], numpy.floating))
     self.assertEqual(cleaned[1], "Infinity")
     self.assertEqual(cleaned[2], 1)
     self.assertEqual(cleaned[3], "A string")
Example #2
0
 def test_dict(self):
     cleaned = sanitize_db_inputs(self.TEST_DATA)
     self.assertEqual(len(cleaned), len(self.TEST_DATA))
     self.assertEqual(cleaned['str'], "A string")
     self.assertEqual(cleaned['int'], 1)
     self.assertEqual(cleaned['infty'], "Infinity")
     self.assertEqual(cleaned['float'], 1.0)
     self.assertFalse(isinstance(cleaned['float'], numpy.floating))