Esempio n. 1
0
 class Meta:
     model = ModelTest
     not_null_validator = None
     type_map = ClassMap({
         sa.Unicode:
         lambda column: (StringField
                         if column.type.length else TextAreaField)
     })
Esempio n. 2
0
 class Meta:
     model = ModelTest
     not_null_validator = None
     type_map = ClassMap({sa.Unicode: TextAreaField})
Esempio n. 3
0
def test_getitem_throws_keyerror_for_unknown_key():
    class_map = ClassMap({A: 3, B: 6})
    with raises(KeyError):
        class_map['unknown']
Esempio n. 4
0
def test_getitem_with_objects(key, value):
    class_map = ClassMap({A: 3, B: 6})
    assert class_map[key] == value
Esempio n. 5
0
def test_contains_with_isinstance_check(key):
    class_map = ClassMap({A: 3, B: 6})
    assert key in class_map
Esempio n. 6
0
def test_init_sorts_items_by_inheritance(items):
    class_map = ClassMap(items)
    assert list(class_map.items()) == [
        (A5, 5), (A4, 4), (A3, 3), (A2, 2), (A, 1)
    ]