Git Product home page Git Product logo

Comments (4)

vvnkr avatar vvnkr commented on June 22, 2024

Have you tried using test_object_after_expression()?

test_function_definition('shout', body = lambda: test_object_after_expression('shout_word'))

test_object() only works in the global scope.

However Filip and me have been thinking about making the notation to test things more 'Pythonic'. These functions are actually in this kind of format (with the lambda/custom defined functions and stuff), because that's how it was done in R. However in Pyhton in might make more sense to write the test you'd like to do like this:

Below is an idea, code won't work

test_function_definition('shout').get_body().test_object('shout_word')

This could make testing in Python more "object-oriented-ish". You could go to a notation like this:

shout_def_body = test_function_definition('shout').get_body()
shout_def_body.test_object('shout_word')
shout_def_body.test_function(...)
shout_def_body.test_if_else(...)

I'm sure we'll discuss this further when Filip's back. Might be interesting to include you in that conversation to get your feedback.

from pythonwhat.

hugobowne avatar hugobowne commented on June 22, 2024

@franciscastro and I will try test_object_after_expression() and let you know how it goes!

from pythonwhat.

vvnkr avatar vvnkr commented on June 22, 2024

@hugobowne did you figure it out?

from pythonwhat.

hugobowne avatar hugobowne commented on June 22, 2024

test_function_definition('shout', body = lambda: test_object_after_expression('shout_word')) works!

@vincentvankrunkelsven

i agree we should discuss a more more "object-oriented-ish" python sct with filip :-)

from pythonwhat.

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.