def process_formdata(self, valuelist):
     if valuelist:
         if valuelist[0] == u'' or valuelist[0] == '':
             self.data = None
         else:
             try:
                 self.data = NumberRange.from_str(valuelist[0])
             except NumberRangeException:
                 self.data = None
                 raise ValueError(self.gettext(self.error_msg))
Exemple #2
0
 def process_formdata(self, valuelist):
     if valuelist:
         if valuelist[0] == u'' or valuelist[0] == '':
             self.data = None
         else:
             try:
                 self.data = NumberRange.from_str(valuelist[0])
             except NumberRangeException:
                 self.data = None
                 raise ValueError(self.gettext(self.error_msg))
Exemple #3
0
 def test_from_str_exception_handling(self):
     with raises(NumberRangeException):
         NumberRange.from_str('1 - ')
Exemple #4
0
 def test_from_str_supports_single_integers(self):
     number_range = NumberRange.from_str('1')
     assert number_range.min_value == 1
     assert number_range.max_value == 1