Beispiel #1
0
 def test_non_numeric_with_obj(self):
     self.assertRaisesMessage(
         ValidationError, _('Expression should not contain numeric values'),
         v.non_numeric, object)
     with self.assertRaises(ValidationError) as e:
         v.non_numeric(object)
     exc = e.exception
     self.assertEqual(exc.code, 'no_numeric_expected')
Beispiel #2
0
 def test_non_numeric_with_mix_of_numbers_and_letters(self):
     self.assertRaisesMessage(
         ValidationError, _('Expression should not contain numeric values'),
         v.non_numeric, 'taa9864867')
     with self.assertRaises(ValidationError) as e:
         v.non_numeric('taa9864867')
     exc = e.exception
     self.assertEqual(exc.code, 'no_numeric_expected')
Beispiel #3
0
 def to_python(self, value):
     arr = []
     for tag in value:
         try:
             obj = Tag.objects.get(tag=tag)
             arr.append(obj.id)
         except ObjectDoesNotExist as e:
             non_numeric(tag)
             obj = Tag(tag=tag, status='p')
             obj.save()
             self.choices.append((value, tag))
             arr.append(obj.id)
     log.debug('to_python::arr %s' % arr)
     return arr
Beispiel #4
0
 def to_python(self, value):
     arr = []
     for cepage in value:
         try:
             obj = Cepage.objects.get(cepage=cepage)
             arr.append(obj)
         except ObjectDoesNotExist as e:
             non_numeric(cepage)
             obj = Cepage(cepage=cepage, status='p')
             obj.save()
             self.choices.append((value, cepage))
             arr.append(obj)
     log.debug('to_python::arr %s' % arr)
     return arr
Beispiel #5
0
 def to_python(self, value):
     arr = []
     for tag in value:
         try:
             obj = Tag.objects.get(tag=tag)
             arr.append(obj.id)
         except ObjectDoesNotExist as e:
             non_numeric(tag)
             obj = Tag(tag=tag,status='p')            
             obj.save()
             self.choices.append((value,tag))
             arr.append(obj.id)
     log.debug('to_python::arr %s' % arr)
     return arr
Beispiel #6
0
 def to_python(self, value):
     arr = []
     for cepage in value:
         try:
             obj = Cepage.objects.get(cepage=cepage)
             arr.append(obj)
         except ObjectDoesNotExist as e:
             non_numeric(cepage)
             obj = Cepage(cepage=cepage,status='p')            
             obj.save()
             self.choices.append((value,cepage))
             arr.append(obj)
     log.debug('to_python::arr %s' % arr)
     return arr
	def test_non_numeric_with_french_character(self):
		self.assertEquals(None,v.non_numeric(u'àâçÀéÉèêëîïôûùüÿñæœ'))
	def test_non_numeric_with_obj(self):
		self.assertRaisesMessage(ValidationError,_('Expression should not contain numeric values'),v.non_numeric,object)
		with self.assertRaises(ValidationError) as e:
			v.non_numeric(object)
		exc  = e.exception
		self.assertEqual(exc.code, 'no_numeric_expected')
	def test_non_numeric_with_mix_of_numbers_and_letters(self):
		self.assertRaisesMessage(ValidationError,_('Expression should not contain numeric values'),v.non_numeric,'taa9864867')
		with self.assertRaises(ValidationError) as e:
			v.non_numeric('taa9864867')
		exc  = e.exception
		self.assertEqual(exc.code, 'no_numeric_expected')
	def test_non_numeric_with_string(self):
		self.assertEquals(None, v.non_numeric('jhksdhjkdhdjk'))
Beispiel #11
0
 def validate(self, value):
     # super(TagField, self).validate(value)
     log.debug('validate::value %s' % value)
     return value
     for cepage in value:
         non_numeric(cepage)
Beispiel #12
0
 def validate(self, value):
     # super(TagField, self).validate(value)
     log.debug('validate::value %s' %  value)
     return value
     for cepage in value:
         non_numeric(cepage)
Beispiel #13
0
 def test_non_numeric_with_french_character(self):
     self.assertEquals(None, v.non_numeric(u'àâçÀéÉèêëîïôûùüÿñæœ'))
Beispiel #14
0
 def test_non_numeric_with_string(self):
     self.assertEquals(None, v.non_numeric('jhksdhjkdhdjk'))