Coder Social home page Coder Social logo

Set defaults in test specs about orca_test HOT 3 OPEN

semcogli avatar semcogli commented on July 18, 2024
Set defaults in test specs

from orca_test.

Comments (3)

smmaurer avatar smmaurer commented on July 18, 2024

I think this might already be implemented, if i'm understanding correctly.

The more specific characteristics build on the more general ones -- for example, if you assert that a column has a minimum value, Orca_test will automatically check that it's numeric, can be generated, and is registered. So in the spec, you only need to list the characteristics that are independent of each other. This isn't in the documentation yet, but i'll add it.

Does this address the issue, or is there more we could be doing?

from orca_test.

semcogli avatar semcogli commented on July 18, 2024

Sorry for the late response. I looked at the code and indeed that's the way it is meant to be. But this test chaining only addresses part of my problem. For example, UrbanSim 1 requires no missing values in columns. If I imply the same logic in UrbanSim2, I need to have no missing test explicit to every data column, right? Same if I have most of my columns are numeric, why not just say "numeric=False" in the few remaining cases? It would be better to have a default setting for majority of the cases to simply the configs.

Thanks.

from orca_test.

smmaurer avatar smmaurer commented on July 18, 2024

I see what you mean. It does seem useful to be able to define context-specific defaults.

Some thoughts about implementation:

One approach would be to write a set() method that would allow users to change an object's properties. This would come in handy in a variety of situations, and would look something like this:

col_defaults = ColumnSpec(numeric=True, missing=False)
t = TableSpec('buildings',
        col_defaults.set(column_name='building_id'),
        col_defaults.set(column_name='residential_price', min=0))

(The method would actually return a new object, to avoid problems with references.)

Or alternatively, we could modify the constructors to accept an existing spec that would serve as a base for the new object.

col_defaults = ColumnSpec(numeric=True, missing=False)
t = TableSpec('buildings',
        ColumnSpec('building_id', base=col_defaults),
        ColumnSpec('residential_price', min=0, base=col_defaults))

I can see both versions of the syntax being useful: the second seems clearer for setting default values, but the first is clearer if you want to modify an existing object. The functionality would be the same, so behind the scenes one could just point to the other.

from orca_test.

Related Issues (18)

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.