Changeset 450

Show
Ignore:
Timestamp:
04/20/09 16:06:25 (4 years ago)
Author:
ged
Message:

added test for defining fields in the parent class of the base class

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • elixir/trunk/tests/test_custombase.py

    r400 r450  
    9797        assert 'common' in B.table.columns.keys() 
    9898 
     99    def test_base_with_fields_in_parent(self): 
     100        class BaseParent(object): 
     101            common1 = Field(String(32)) 
     102 
     103        class FieldBase(BaseParent): 
     104            __metaclass__ = EntityMeta 
     105 
     106            common2 = Field(String(32)) 
     107 
     108        class A(FieldBase): 
     109            name = Field(String(32)) 
     110 
     111        class B(FieldBase): 
     112            pass 
     113 
     114        setup_all(True) 
     115 
     116        assert 'name' in A.table.columns.keys() 
     117        assert 'common1' in A.table.columns.keys() 
     118        assert 'common1' in B.table.columns.keys() 
     119        assert 'common2' in A.table.columns.keys() 
     120        assert 'common2' in B.table.columns.keys() 
     121 
    99122    def test_base_with_options(self): 
    100123        import re