Ejemplo n.º 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')
Ejemplo n.º 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')
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 7
0
	def test_non_numeric_with_french_character(self):
		self.assertEquals(None,v.non_numeric(u'àâçÀéÉèêëîïôûùüÿñæœ'))
Ejemplo n.º 8
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')
Ejemplo n.º 9
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')
Ejemplo n.º 10
0
	def test_non_numeric_with_string(self):
		self.assertEquals(None, v.non_numeric('jhksdhjkdhdjk'))
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 13
0
 def test_non_numeric_with_french_character(self):
     self.assertEquals(None, v.non_numeric(u'àâçÀéÉèêëîïôûùüÿñæœ'))
Ejemplo n.º 14
0
 def test_non_numeric_with_string(self):
     self.assertEquals(None, v.non_numeric('jhksdhjkdhdjk'))