コード例 #1
0
    def test_teaching_ddf(self):
        teach('django_dynamic_fixture.ModelWithUnsupportedField', z='z')
        succeeded, errors = ddf_check_models()

        compatible_models = [
            'django_dynamic_fixture.ModelWithUnsupportedField',
        ]
        for model in compatible_models:
            assert model in succeeded.keys(), model
            assert model not in errors.keys(), model
コード例 #2
0
    def test_global_lesson(self):
        teach(ModelForLibrary, integer=1000)
        instance = G(ModelForLibrary)
        assert instance.integer == 1000

        instance = G(ModelForLibrary, integer=1001)
        assert instance.integer == 1001

        instance = G(ModelForLibrary)
        assert instance.integer == 1000
コード例 #3
0
 def setUp(self):
     DDFLibrary.instance = DDFLibrary(
     )  # singleton object is cleared by another tests
     teach(ModelForDDFSetup, integer=9999)  # using EXCLUSIVE_DDF_LIBRARY
コード例 #4
0
 def setUp(self):
     DDFLibrary.instance = DDFLibrary()
     teach(ModelForDDFSetup, integer=1000, ddf_lesson='test1')
     teach(ModelForDDFSetup, integer=1001)
     teach(ModelForDDFSetup, integer=1002, ddf_lesson='test2')
コード例 #5
0
 def test_compatibility_for_teach(self):
     teach('django_dynamic_fixture.ModelWithDefaultValues',
           integer_with_default=5)
     instance = G('django_dynamic_fixture.ModelWithDefaultValues')
     assert instance.integer_with_default == 5