-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UnifiedAlchemyMagicMock does not work with .label() #24
Comments
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') |
@miki725 Thanks for answering. The problem is that when 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()
)
]) |
I meant can you post results running |
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 |
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! |
#25 adds labels support. can you test that branch? |
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? |
just released |
Hello,
I have this query in my function to be tested:
I am trying to mock it out like this:
After Ive added these three guys, that make use of .label() does not work anymore.
Is this a known issue? or might be am I doing something wrong. any clue is more than welcome.
The text was updated successfully, but these errors were encountered: