def test_min_depth_data_types(self): ''' test that min_depth works on numerous data types ''' self.assertEqual(min_depth([75, 150], 0.03), 5) self.assertEqual(min_depth((75, 150), 0.03), 5) self.assertEqual(min_depth(numpy.array([75, 150]), 0.03), 5) self.assertEqual(min_depth(pandas.Series([75, 150]), 0.03), 5)
def test_min_depth(self): ''' test estimating the minumum allowed depth ''' self.assertEqual(min_depth(100, 0.01), 2) self.assertEqual(min_depth(150, 0.03), 7) # and try modulating the certainty threshold self.assertEqual(min_depth(150, 0.03, threshold=0.5), 3) self.assertEqual(min_depth(150, 0.03, threshold=0.999), 9)
def test_min_depth_errors(self): ''' test that min depth raises appropriate errors ''' with self.assertRaises(AssertionError): # raise errors with non-standard lengths of depths min_depth([75, 150, 50], 0.03) min_depth([75], 0.03) min_depth([], 0.03) # raise an error with an unobtainable certainty threshold min_depth(75, 0.01, 1.0)