您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

tests.py 617B

123456789101112131415161718
  1. import unittest
  2. from django.test import TestCase
  3. from oscar.core.loading import import_module, AppNotFoundError
  4. class ImportAppTests(unittest.TestCase):
  5. def test_a_specified_class_is_imported_correctly(self):
  6. module = import_module('product.models', ['Item'])
  7. self.assertEqual('oscar.apps.product.models', module.__name__)
  8. def test_unknown_apps_raise_exception(self):
  9. self.assertRaises(AppNotFoundError, import_module, 'banana', ['skin'])
  10. def test_no_classes_specified_raise_exception(self):
  11. self.assertRaises(ValueError, import_module, 'product.models')