コード例 #1
0
 def test_normalization(self):
     # weight_list, expected_result, minval, maxval
     map_ = (
         ((), (), None, None),
         ((0.0, 0.0), (0.0, 0.0), None, None),
         ((1.0, 1.0), (0.0, 0.0), None, None),
         ((20.0, 50.0), (0.0, 1.0), None, None),
         ((20.0, 50.0), (0.0, 0.375), None, 100.0),
         ((20.0, 50.0), (0.4, 1.0), 0.0, None),
         ((20.0, 50.0), (0.2, 0.5), 0.0, 100.0),
     )
     for seq, result, minval, maxval in map_:
         ret = weights.normalize(seq, minval=minval, maxval=maxval)
         self.assertEqual(tuple(ret), result)
コード例 #2
0
ファイル: test_weights.py プロジェクト: AsherBond/nova
    def test_normalization(self):
        # weight_list, expected_result, minval, maxval
        map_ = (
            ((), (), None, None),
            ((0.0, 0.0), (0.0, 0.0), None, None),
            ((1.0, 1.0), (0.0, 0.0), None, None),

            ((20.0, 50.0), (0.0, 1.0), None, None),
            ((20.0, 50.0), (0.0, 0.375), None, 100.0),
            ((20.0, 50.0), (0.4, 1.0), 0.0, None),
            ((20.0, 50.0), (0.2, 0.5), 0.0, 100.0),
        )
        for seq, result, minval, maxval in map_:
            ret = weights.normalize(seq, minval=minval, maxval=maxval)
            self.assertEqual(tuple(ret), result)