Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_value_is_more_than_upper_produces_upper(self):
lower, value, upper = 1, 3, 2
result = endpoint.Endpoint.clamp(value, lower=lower, upper=upper)
self.assertEqual(result, upper)
def test_value_lower_and_upper_are_zero(self):
result = endpoint.Endpoint.clamp(0, lower=0, upper=0)
self.assertEqual(result, 0)
def test_value_lower_and_upper_are_negative(self):
result = endpoint.Endpoint.clamp(-1, lower=-1, upper=-1)
self.assertEqual(result, -1)
def test_value_is_least_produces_given_lower(self):
lower, upper, value = 3, 2, 1
result = endpoint.Endpoint.clamp(value, lower=lower, upper=upper)
self.assertEqual(result, lower)
def test_value_is_greatest_produces_given_lower(self):
value, lower, upper = 3, 2, 1
result = endpoint.Endpoint.clamp(value, lower=lower, upper=upper)
self.assertEqual(result, lower)
def test_value_is_less_than_lower_produces_lower(self):
lower, value, upper = 2, 1, 3
result = endpoint.Endpoint.clamp(value, lower=lower, upper=upper)
self.assertEqual(result, lower)
def test_value_lower_and_upper_are_positive(self):
result = endpoint.Endpoint.clamp(1, lower=1, upper=1)
self.assertEqual(result, 1)
def test_value_between_lower_and_upper_produces_given_lower(self):
lower, value, upper = 3, 2, 1
result = endpoint.Endpoint.clamp(value, lower=lower, upper=upper)
self.assertEqual(result, lower)
def test_value_between_lower_and_upper_produces_value(self):
lower, value, upper = 1, 2, 3
result = endpoint.Endpoint.clamp(value, lower=lower, upper=upper)
self.assertEqual(result, value)