def test_with_relationship(self, model_factory): Parent = model_factory(name='Parent') child_cols = [ Column('parent_id', ForeignKey('parent.id')), ] child_rels = {'parent': relationship(Parent, backref='children')} Child = model_factory(child_cols, 'Child', relationships=child_rels) assert sorted(util.get_pks(Child)) == ['id']
def test_with_relationship(self, model_factory): Parent = model_factory(name='Parent') child_cols = [ Column('parent_id', ForeignKey('parent.id')), ] child_rels = {'parent': relationship(Parent, backref='children')} Child = model_factory(child_cols, 'Child', relationships=child_rels) assert sorted(util.get_pks(Child)) == ['id']
def test_single_pk(self, Model_one_pk): assert sorted(util.get_pks(Model_one_pk)) == ['id']
def test_different_colname(self, Model_diff_colname): assert sorted(util.get_pks(Model_diff_colname)) == ['id']
def test_multiple_pks(self, Model_two_pk): assert sorted(util.get_pks(Model_two_pk)) == ['id', 'id2']
def test_single_pk(self, Model_one_pk): assert sorted(util.get_pks(Model_one_pk)) == ['id']
def test_different_colname(self, Model_diff_colname): assert sorted(util.get_pks(Model_diff_colname)) == ['id']
def test_multiple_pks(self, Model_two_pk): assert sorted(util.get_pks(Model_two_pk)) == ['id', 'id2']