瀏覽代碼

Move and skip some tests

Yann Weber 9 年之前
父節點
當前提交
4fedabcf88
共有 3 個檔案被更改,包括 6 行新增63 行删除
  1. 1
    0
      leapi/leobject.py
  2. 2
    62
      leapi/test/test_leobject.py
  3. 3
    1
      leapi/test/test_letype.py

+ 1
- 0
leapi/leobject.py 查看文件

@@ -316,6 +316,7 @@ class _LeObject(object):
316 316
     # @todo Delete the checks of letype and leclass and ensure that this method is called with letype and leclass arguments from _prepare_targets()
317 317
     #
318 318
     # @see @ref leobject_filters
319
+    # @todo delete me
319 320
     @staticmethod
320 321
     def _check_fields(letype, leclass, fields):
321 322
         warnings.warn("deprecated", DeprecationWarning)

+ 2
- 62
leapi/test/test_leobject.py 查看文件

@@ -23,47 +23,6 @@ class LeObjectTestCase(TestCase):
23 23
         """ Remove the temporary directory created at class setup """
24 24
         leapi.test.utils.cleanup(cls.tmpdir)
25 25
 
26
-    def test_split_query_filter(self):
27
-        """ Tests the _split_filter() classmethod """
28
-        import dyncode
29
-        query_results = {
30
-            'Hello = world' : ('Hello', '=', 'world'),
31
-            'hello <= "world"': ('hello', '<=', '"world"'),
32
-            '_he42_ll-o >= \'world"': ('_he42_ll-o', '>=', '\'world"'),
33
-            'foo in ["foo", 42, \'bar\']': ('foo', ' in ', '["foo", 42, \'bar\']'),
34
-            ' bar42              < 42': ('bar42', '<', '42'),
35
-            ' _hidden > 1337': ('_hidden', '>', '1337'),
36
-            '_42 not in foobar': ('_42', ' not in ', 'foobar'),
37
-            'hello                       in      foo':('hello', ' in ', 'foo'),
38
-            "\t\t\thello\t\t\nin\nfoo\t\t\n\t":('hello', ' in ', 'foo'),
39
-            "hello \nnot\tin \nfoo":('hello', ' not in ', 'foo'),
40
-            'hello != bar':('hello', '!=', 'bar'),
41
-            'hello = "world>= <= != in not in"': ('hello', '=', '"world>= <= != in not in"'),
42
-            'superior.parent = 13': ('superior.parent', '=', '13'),
43
-        }
44
-        for query, result in query_results.items():
45
-            res = dyncode.LeObject._split_filter(query)
46
-            self.assertEqual(res, result, "When parsing the query : '%s' the returned value is different from the expected '%s'"%(query, result))
47
-
48
-    def test_invalid_split_query_filter(self):
49
-        """ Testing the _split_filter() method with invalid queries """
50
-        import dyncode
51
-        invalid_queries = [
52
-            '42 = 42',
53
-            '4hello = foo',
54
-            'foo == bar',
55
-            'hello >> world',
56
-            'hello =    ',
57
-            ' = world',
58
-            '=',
59
-            '42',
60
-            '"hello" = world',
61
-            'foo.bar = 15',
62
-        ]
63
-        for query in invalid_queries:
64
-            with self.assertRaises(ValueError, msg='But the query was not valid : "%s"'%query):
65
-                dyncode.LeObject._split_filter(query)
66
-
67 26
     def test_uid2leobj(self):
68 27
         """ Testing _Leobject.uid2leobj() """
69 28
         import dyncode
@@ -104,6 +63,7 @@ class LeObjectTestCase(TestCase):
104 63
         for (leclass, letype), (rleclass, rletype) in test_v.items():
105 64
             self.assertEqual((rletype,rleclass), LeObject._prepare_targets(letype, leclass))
106 65
 
66
+    @unittest.skip("Obsolete but may be usefull for datasources tests")
107 67
     def test_invalid_prepare_targets(self):
108 68
         """ Testing _prepare_targets() method with invalid arguments """
109 69
         from dyncode import Publication, Numero, LeObject, Personnes
@@ -129,7 +89,7 @@ class LeObjectTestCase(TestCase):
129 89
         for (leclass, letype) in test_v:
130 90
             with self.assertRaises(ValueError):
131 91
                 LeObject._prepare_targets(letype, leclass)
132
-
92
+    @unittest.skip("Obsolete, the method should be deleted soon")
133 93
     def test_check_fields(self):
134 94
         """ Testing the _check_fields() method """
135 95
         from dyncode import Publication, Numero, LeObject, Personnes
@@ -148,26 +108,6 @@ class LeObjectTestCase(TestCase):
148 108
             LeObject._check_fields(None, None, Numero._fields)
149 109
 
150 110
 
151
-    def test_prepare_filters_invalid(self):
152
-        """ Testing the _prepare_filters() method """
153
-        from dyncode import Publication, Numero, LeObject, Personnes
154
-
155
-        #Numero fields filters but no letype nor leclass given
156
-        filters = []
157
-        res_filt = []
158
-        for field in Numero._fields:
159
-            filters.append('%s=1'%field)
160
-            res_filt.append((field, '=', '1'))
161
-        
162
-        with self.assertRaises(leapi.lecrud.LeApiDataCheckError):
163
-            LeObject._prepare_filters(filters)
164
-
165
-
166
-        #simply invalid filters
167
-        filters = ['hello world !']
168
-        with self.assertRaises(ValueError):
169
-            LeObject._prepare_filters(filters)
170
-
171 111
 class LeObjectMockDatasourceTestCase(TestCase):
172 112
     """ Testing _LeObject using a mock on the datasource """
173 113
 

+ 3
- 1
leapi/test/test_letype.py 查看文件

@@ -20,7 +20,8 @@ class LeTypeTestCase(TestCase):
20 20
     def tearDownClass(cls):
21 21
         """ Remove the temporary directory created at class setup """
22 22
         leapi.test.utils.cleanup(cls.tmpdir)
23
- 
23
+
24
+    @unittest.skip("Waiting for EmFieldType full implementation")
24 25
     def test_init(self):
25 26
         """ testing the constructor """
26 27
         from dyncode import Publication, Numero, LeObject
@@ -45,6 +46,7 @@ class LeTypeTestCase(TestCase):
45 46
                 Numero(**badarg)
46 47
     
47 48
     ## @todo when we will have a field in a type that has a check_function try to make check_datas_or_raise raise with invalid value
49
+    @unittest.skip("Waiting for EmFieldType full implementation")
48 50
     def test_check_datas(self):
49 51
         """ testing the check_datas* methods """
50 52
         from dyncode import Publication, Numero, LeObject

Loading…
取消
儲存