Exemple #1
0
 def test_float_range_above_max_centered(self):
     range = Range(.5, 2.5)
     self.assertEqual(2, range.normalize(3.5, zero_centered=True), 'Zero centered normalization failed')
Exemple #2
0
 def test_float_range_middle_centered(self):
     range = Range(.5, 2.5)
     self.assertEqual(0, range.normalize(1.5, zero_centered=True), 'Zero centered normalization failed')
Exemple #3
0
 def test_float_range_below_min_centered(self):
     range = Range(.5, 2.5)
     self.assertEqual(-2, range.normalize(-0.5, zero_centered=True), 'Zero centered normalization failed')
Exemple #4
0
 def test_float_range_above_max_not_centered(self):
     range = Range(.5, 2.5)
     self.assertEqual(1.5, range.normalize(3.5, zero_centered=False), 'Normalization failed')
Exemple #5
0
 def test_float_range_below_min_not_centered(self):
     range = Range(.5, 2.5)
     self.assertEqual(-0.5, range.normalize(-0.5, zero_centered=False), 'Normalization failed')
Exemple #6
0
 def test_int_range_above_max_centered(self):
     range = Range(1, 5)
     self.assertEqual(2, range.normalize(7, zero_centered=True), 'Zero centered normalization failed')
Exemple #7
0
 def test_int_range_below_min_centered(self):
     range = Range(1, 5)
     self.assertEqual(-2, range.normalize(-1, zero_centered=True), 'Zero centered normalization failed')
Exemple #8
0
 def test_int_range_middle_not_centered(self):
     range = Range(1, 5)
     self.assertEqual(.5, range.normalize(3, zero_centered=False), 'Normalization failed')