예제 #1
0
 def test_set_value(self):
     uuids = [
         '0203a23f-032c-46be-a1fa-c85fd0284b4c',
         'd2e6a469-a4fd-415e-8c22-b8d73856a714',
         '8832f5cd-c024-49ce-b27a-8d6e388f3b08'
     ]
     field = ListField(UUIDField, required=True)
     field.set_value(value=uuids)
     field.validate()
     self.assertIn('0203a23f-032c-46be-a1fa-c85fd0284b4c'.upper(),
                   field.to_native())
     self.assertIn('d2e6a469-a4fd-415e-8c22-b8d73856a714'.upper(),
                   field.to_native())
     self.assertIn('8832f5cd-c024-49ce-b27a-8d6e388f3b08'.upper(),
                   field.to_native())
     self.assertIn(uuid.UUID('0203a23f-032c-46be-a1fa-c85fd0284b4c'),
                   field.to_python())
     self.assertIn(uuid.UUID('d2e6a469-a4fd-415e-8c22-b8d73856a714'),
                   field.to_python())
     self.assertIn(uuid.UUID('8832f5cd-c024-49ce-b27a-8d6e388f3b08'),
                   field.to_python())
     self.assertEqual(len(field), 3)
     self.assertEqual(uuid.UUID('0203a23f-032c-46be-a1fa-c85fd0284b4c'),
                      field[0])
     self.assertEqual(uuid.UUID('d2e6a469-a4fd-415e-8c22-b8d73856a714'),
                      field[1])
     self.assertEqual(uuid.UUID('8832f5cd-c024-49ce-b27a-8d6e388f3b08'),
                      field[2])
예제 #2
0
 def test_set_value(self):
     uuids = [
         '0203a23f-032c-46be-a1fa-c85fd0284b4c',
         'd2e6a469-a4fd-415e-8c22-b8d73856a714',
         '8832f5cd-c024-49ce-b27a-8d6e388f3b08'
     ]
     field = ListField(UUIDField, required=True)
     field.set_value(value=uuids)
     field.validate()
     self.assertIn('0203a23f-032c-46be-a1fa-c85fd0284b4c'.upper(), field.to_native())
     self.assertIn('d2e6a469-a4fd-415e-8c22-b8d73856a714'.upper(), field.to_native())
     self.assertIn('8832f5cd-c024-49ce-b27a-8d6e388f3b08'.upper(), field.to_native())
     self.assertIn(uuid.UUID('0203a23f-032c-46be-a1fa-c85fd0284b4c'), field.to_python())
     self.assertIn(uuid.UUID('d2e6a469-a4fd-415e-8c22-b8d73856a714'), field.to_python())
     self.assertIn(uuid.UUID('8832f5cd-c024-49ce-b27a-8d6e388f3b08'), field.to_python())
     self.assertEqual(len(field), 3)
     self.assertEqual(uuid.UUID('0203a23f-032c-46be-a1fa-c85fd0284b4c'), field[0])
     self.assertEqual(uuid.UUID('d2e6a469-a4fd-415e-8c22-b8d73856a714'), field[1])
     self.assertEqual(uuid.UUID('8832f5cd-c024-49ce-b27a-8d6e388f3b08'), field[2])
예제 #3
0
 def test_set_value(self):
     emails = [
         '*****@*****.**', '*****@*****.**', '*****@*****.**',
         '*****@*****.**'
     ]
     field = ListField(EmailField, required=True)
     field.set_value(value=emails)
     field.validate()
     self.assertIn('*****@*****.**', field.to_native())
     self.assertIn('*****@*****.**', field.to_python())
     self.assertEqual(len(field), 4)
     self.assertEqual('*****@*****.**', field[0])
     self.assertEqual('*****@*****.**', field[1])
     self.assertEqual('*****@*****.**', field[2])
     self.assertEqual('*****@*****.**', field[3])
     for email in field:
         self.assertIn(email, emails)
예제 #4
0
 def test_set_value(self):
     emails = [
         '*****@*****.**',
         '*****@*****.**',
         '*****@*****.**',
         '*****@*****.**'
     ]
     field = ListField(EmailField, required=True)
     field.set_value(value=emails)
     field.validate()
     self.assertIn('*****@*****.**', field.to_native())
     self.assertIn('*****@*****.**', field.to_python())
     self.assertEqual(len(field), 4)
     self.assertEqual('*****@*****.**', field[0])
     self.assertEqual('*****@*****.**', field[1])
     self.assertEqual('*****@*****.**', field[2])
     self.assertEqual('*****@*****.**', field[3])
     for email in field:
         self.assertIn(email, emails)