Coder Social home page Coder Social logo

Comments (8)

miki725 avatar miki725 commented on July 30, 2024 1

#25 adds labels support. can you test that branch?

from alchemy-mock.

hozher avatar hozher commented on July 30, 2024 1

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.

miki725 avatar miki725 commented on July 30, 2024 1

just released 0.4.2. should be able to install from pypi. let me know if any further issues

from alchemy-mock.

miki725 avatar miki725 commented on July 30, 2024

dont think tested with labels. could be the comparison logic does not correctly compare labels. Can you try using

class ExpressionMatcher(PrettyExpression):
to manually compare labels?
so something like:

ExpressionMatcher(Area.name.label('area')) == Area.name.label('area')

from alchemy-mock.

hozher avatar hozher commented on July 30, 2024

@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.

miki725 avatar miki725 commented on July 30, 2024

I meant can you post results running ExpressionMatcher by itself. I dont know if its capable of comparing label objects

from alchemy-mock.

hozher avatar hozher commented on July 30, 2024

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.

miki725 avatar miki725 commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.