Browse Source

Changed the used method for the check_data tests (using now the public one instead of the protected)

Roland Haroutiounian 8 years ago
parent
commit
e9174bb847

+ 2
- 2
tests/datahandlers/test_boolean.py View File

10
 
10
 
11
         # correct values
11
         # correct values
12
         for test_value in [True, False]:
12
         for test_value in [True, False]:
13
-            value, error = test_boolean._check_data_value(test_value)
13
+            value, error = test_boolean.check_data_value(test_value)
14
             self.assertIsNone(error)
14
             self.assertIsNone(error)
15
 
15
 
16
         # incorrect values
16
         # incorrect values
17
         for test_value in ['ok', 'True', 'False']:
17
         for test_value in ['ok', 'True', 'False']:
18
-            value, error = test_boolean._check_data_value(test_value)
18
+            value, error = test_boolean.check_data_value(test_value)
19
             self.assertIsNotNone(error)
19
             self.assertIsNotNone(error)
20
 
20
 
21
     def test_can_override(self):
21
     def test_can_override(self):

+ 2
- 2
tests/datahandlers/test_integer.py View File

10
 
10
 
11
         # Incorrect values
11
         # Incorrect values
12
         for test_bad_value in ['ok','ceci est un test', '15.2', 15.2]:
12
         for test_bad_value in ['ok','ceci est un test', '15.2', 15.2]:
13
-            _, error = test_int._check_data_value(test_bad_value)
13
+            _, error = test_int.check_data_value(test_bad_value)
14
             self.assertIsNotNone(error)
14
             self.assertIsNotNone(error)
15
 
15
 
16
         # Correct values
16
         # Correct values
17
         for test_correct_value in [10, '15', '15.0']:
17
         for test_correct_value in [10, '15', '15.0']:
18
-            _, error = test_int._check_data_value(test_correct_value)
18
+            _, error = test_int.check_data_value(test_correct_value)
19
             self.assertIsNone(error)
19
             self.assertIsNone(error)
20
 
20
 
21
     def test_can_override(self):
21
     def test_can_override(self):

+ 3
- 3
tests/datahandlers/test_regex.py View File

9
         test_value = '126.205.255.12'
9
         test_value = '126.205.255.12'
10
         test_regex = Regex('^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$',
10
         test_regex = Regex('^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$',
11
                            max_length=100)
11
                            max_length=100)
12
-        value, error = test_regex._check_data_value(test_value)
12
+        value, error = test_regex.check_data_value(test_value)
13
         self.assertIsNone(error)
13
         self.assertIsNone(error)
14
         self.assertEqual(value, test_value)
14
         self.assertEqual(value, test_value)
15
 
15
 
17
         test_regex = Regex('^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$',
17
         test_regex = Regex('^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$',
18
                            max_length=15)
18
                            max_length=15)
19
         for test_value in ['800.9.10.5', 'test_string_value', '999.999.999.999']:
19
         for test_value in ['800.9.10.5', 'test_string_value', '999.999.999.999']:
20
-            value, error = test_regex._check_data_value(test_value)
20
+            value, error = test_regex.check_data_value(test_value)
21
             self.assertEqual(value, '')
21
             self.assertEqual(value, '')
22
             self.assertIsNotNone(error)
22
             self.assertIsNotNone(error)
23
 
23
 
25
         test_max_length = 15
25
         test_max_length = 15
26
         test_regex = Regex('[a-z]+8?', max_length=15)
26
         test_regex = Regex('[a-z]+8?', max_length=15)
27
         for test_value in ['cccccc8', 'ccccccccccccccccccccccccccccccccc8']:
27
         for test_value in ['cccccc8', 'ccccccccccccccccccccccccccccccccc8']:
28
-            value, error = test_regex._check_data_value(test_value)
28
+            value, error = test_regex.check_data_value(test_value)
29
             if len(test_value)>test_max_length:
29
             if len(test_value)>test_max_length:
30
                 self.assertEqual(value, '')
30
                 self.assertEqual(value, '')
31
                 self.assertIsNotNone(error)
31
                 self.assertIsNotNone(error)

+ 1
- 1
tests/datahandlers/test_text.py View File

11
         Text
11
         Text
12
         """
12
         """
13
         test_text = Text()
13
         test_text = Text()
14
-        _, error = test_text._check_data_value(test_value)
14
+        _, error = test_text.check_data_value(test_value)
15
         self.assertIsNone(error)
15
         self.assertIsNone(error)

+ 3
- 3
tests/datahandlers/test_varchar.py View File

8
     def test_check_data_value(self):
8
     def test_check_data_value(self):
9
         test_varchar = Varchar(max_length=10)
9
         test_varchar = Varchar(max_length=10)
10
 
10
 
11
-        _, error = test_varchar._check_data_value("c" * 10)
11
+        _, error = test_varchar.check_data_value("c" * 10)
12
         self.assertIsNone(error)
12
         self.assertIsNone(error)
13
 
13
 
14
-        _, error = test_varchar._check_data_value("c" * 9)
14
+        _, error = test_varchar.check_data_value("c" * 9)
15
         self.assertIsNone(error)
15
         self.assertIsNone(error)
16
 
16
 
17
-        _, error = test_varchar._check_data_value("c" * 11)
17
+        _, error = test_varchar.check_data_value("c" * 11)
18
         self.assertIsNotNone(error)
18
         self.assertIsNotNone(error)
19
         self.assertIsInstance(error, ValueError)
19
         self.assertIsInstance(error, ValueError)
20
 
20
 

Loading…
Cancel
Save