Comments (8)
#25 adds labels support. can you test that branch?
from alchemy-mock.
It works pretty well 😃
>>> from alchemy_mock.comparison import ExpressionMatcher
>>> from model import Area
>>> ExpressionMatcher(Area.name.label('area')) == Area.name.label('area')
True
Thanks a lot! merge, might be?
from alchemy-mock.
just released 0.4.2
. should be able to install from pypi. let me know if any further issues
from alchemy-mock.
dont think tested with labels. could be the comparison logic does not correctly compare labels. Can you try using
alchemy-mock/alchemy_mock/comparison.py
Line 60 in e8a9d61
so something like:
ExpressionMatcher(Area.name.label('area')) == Area.name.label('area')
from alchemy-mock.
@miki725 Thanks for answering.
The problem is that when query
gets called is not returning any value (not getting mocked) I did the ExpressionMatcher
whiteout success as follows:
return UnifiedAlchemyMagicMock(data=[
(
[mock.call.query(
WhitelistedEmail.whitelistEmailId,
WhitelistedEmail.areaId,
WhitelistedEmail.businessNameId,
WhitelistedEmail.email,
WhitelistedEmail.identificationNumber,
WhitelistedEmail.isRegistered,
WhitelistedEmail.serviceTypeId,
ExpressionMatcher(Area.name.label('area')) == Area.name.label('area'),
ExpressionMatcher(BusinessName.name.label('businessName')) == BusinessName.name.label('businessName'),
ExpressionMatcher(ServiceType.name.label('serviceType')) == ServiceType.name.label('serviceType'),
)], Factory.get_list()
)
])
from alchemy-mock.
I meant can you post results running ExpressionMatcher
by itself. I dont know if its capable of comparing label objects
from alchemy-mock.
alright, i got this:
print(ExpressionMatcher(Area.name.label('area')) == Area.name.label('area'))
print(ExpressionMatcher(BusinessName.name.label('businessName')) == BusinessName.name.label('businessName'))
print(ExpressionMatcher(ServiceType.name.label('serviceType')) == ServiceType.name.label('serviceType'))
"Area".name = "Area".name
"BusinessName".name = "BusinessName".name
"ServiceType".name = "ServiceType".name
from alchemy-mock.
yep thats not supported. should of gotten a boolean if it was. Ill try to add support at some point or feel free to submit a PR!
from alchemy-mock.
Related Issues (20)
- Issue with getting data twice. HOT 6
- Can I mock session.add() ? HOT 3
- '&' filter is not working HOT 2
- selecting single columns does not work HOT 5
- No have paginate in session.query HOT 2
- more examples? HOT 1
- Need support for "distinct" function HOT 1
- Support for .select_from() and .subquery() HOT 1
- UnifiedAlchemyMagicMock should support execute HOT 2
- clearing a session's history for testing calls HOT 5
- Fail when call delete if the object doesn't exist. HOT 2
- Should support get() with non-tuple values HOT 3
- Importing ABC directly from collections will be removed in Python 3.10 HOT 2
- get() returns None HOT 1
- A forked version of this library HOT 1
- #Issue filter_by does not affect the output of the query HOT 1
- Can mock-alchemy or alchemy-mock be used to mock session.execute(selectObject).where(...).scalars.fetchAll? HOT 1
- session.execute(text(<sql>), params).fetchall() returns mock rather than data configured in UnifiedAlchemyMagicMock HOT 1
- session.execute(text(<sql>), params).mappings().all() returns empty list rather than data configured in UnifiedAlchemyMagicMock HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alchemy-mock.