From a5c9696a7c8cb30cfa47e20f9b31ac42f6d70098 Mon Sep 17 00:00:00 2001 From: Chris Withers Date: Wed, 7 Apr 2010 18:09:21 +0100 Subject: [PATCH] Add instructions to install nose adn NB that it won't happen by magic --- README.unittests | 7 +++++++ test/ext/test_declarative.py | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/README.unittests b/README.unittests index dee34a106b..dd2f6ab1bd 100644 --- a/README.unittests +++ b/README.unittests @@ -13,6 +13,13 @@ http://somethingaboutorange.com/mrl/projects/nose/0.11.1/index.html SQLAlchemy implements a nose plugin that must be present when tests are run. This plugin is available when SQLAlchemy is installed via setuptools. +NB: You will need to manually install nose, it is unlikely to be pulled + down as a dependency of installing SQLAlchemy. + + Nose can be installed with: + + $ easy_install nose + INSTANT TEST RUNNER ------------------- diff --git a/test/ext/test_declarative.py b/test/ext/test_declarative.py index 67e650c34f..4fa59a62d5 100644 --- a/test/ext/test_declarative.py +++ b/test/ext/test_declarative.py @@ -2101,6 +2101,27 @@ class DeclarativeMixinTest(DeclarativeTestBase): assert class_mapper(Person).polymorphic_on is Person.__table__.c.type eq_(class_mapper(Engineer).polymorphic_identity, 'Engineer') + def test_mapper_args_classproperty_three(self): + + class Person(Base): + __tablename__ = 'people' + id = Column(Integer, primary_key=True) + discriminator = Column('type', String(50)) + @classproperty + def __mapper_args__(cls): + if cls.__name__=='Person': + return dict(polymorphic_on=cls.discriminator) + else: + return dict(polymorphic_identity=cls.__name__) + + class Engineer(Person): + pass + + compile_mappers() + + assert class_mapper(Person).polymorphic_on is Person.__table__.c.type + eq_(class_mapper(Engineer).polymorphic_identity, 'Engineer') + def test_table_args_composite(self): class MyMixin1: -- 2.47.3