瀏覽代碼

Fixing tests name to actually make them run

Test functions name as tests files name must begin with test in order to be run by manage.py test
Yann Weber 10 年之前
父節點
當前提交
18c497a27b
共有 3 個檔案被更改,包括 4 行新增5 行删除
  1. 2
    2
      EditorialModel/lib/component.py
  2. 0
    0
      EditorialModel/test/__init__.py
  3. 2
    3
      EditorialModel/test/test_component.py

+ 2
- 2
EditorialModel/lib/component.py 查看文件

@@ -16,9 +16,9 @@ class EmComponent(object):
16 16
     def __init__(self, id_or_name):
17 17
         if self is EmComponent:
18 18
             raise EnvironmentError('Abstract class')
19
-        if id_or_name is int:
19
+        if type(id_or_name) is int:
20 20
             self.id = id_or_name
21
-        elif id_or_name is str:
21
+        elif type(id_or_name) is str:
22 22
             self.name = id_or_name
23 23
             self.populate()
24 24
         else:

+ 0
- 0
EditorialModel/test/__init__.py 查看文件


EditorialModel/test.py → EditorialModel/test/test_component.py 查看文件

@@ -2,8 +2,7 @@ from django.test import TestCase
2 2
 from EditorialModel.lib.component import EmComponent
3 3
 
4 4
 class ComponentTestCase(TestCase):
5
-    def setup(self):
6
-        testComp = EmComponent(2)
7 5
 
8
-    def component_instanciate_with_numeric_id(self):
6
+    def test_component_instanciate_with_numeric_id(self):
7
+        testComp = EmComponent(2)
9 8
         self.assertEqual(testComp.id, 2)

Loading…
取消
儲存