Преглед на файлове

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 преди 9 години
родител
ревизия
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…
Отказ
Запис