miki725 / alchemy-mock

SQLAlchemy mock helpers.
Other
82 stars 15 forks source link

selecting single columns does not work #21

Open filthysocks opened 5 years ago

filthysocks commented 5 years ago

Selecting single columns does not work for me. eg. the following is not working

db = UnifiedAlchemyMagicMock()
db.session.query(MyTable.col).all()
miki725 commented 5 years ago

what is the error?

filthysocks commented 5 years ago

none, it just returns an empty list but if run it on all columns

db = UnifiedAlchemyMagicMock()
db.session.query(MyTable).all()

i get results. The column alwalys has a value

miki725 commented 5 years ago

how do you provide data to UnifiedAlchemyMagicMock? 2 provided examples should return empty list unless you do something else

AlaricWhitney commented 4 years ago

I've proven out that selecting columns doesn't work:

session = UnifiedAlchemyMagicMock()
session.add(Model(col1=1, col2=2))
v = session.query(Model.col2).first()
assert v.col2 == 2
# None - assert fails
session = UnifiedAlchemyMagicMock()
session.add(Model(col1=1, col2=2))
v = session.query(Model).first()
assert v.col2 == 2
# 2 - assert passes
rgreweldinger commented 2 years ago

Were there any updates on this? I'm running into the same issues.