Giter Club home page Giter Club logo

Comments (9)

jhofman avatar jhofman commented on May 21, 2024

Looping @chisingh in on this, let's coordinate on unit tests for R and python.

One idea that wasn't obvious when this was created, but makes sense now: unit tests can check the specs generated on the backend language side, perhaps not a checksum or hash but checking for certain key fields in the generated json.

from datamations.

jhofman avatar jhofman commented on May 21, 2024

It looks like there are some old specs that no longer work, e.g. here:

https://github.com/microsoft/datamations/blob/main/inst/htmlwidgets/test/index.html

Let's get rid of them to avoid confusion going forward.

from datamations.

sharlagelfand avatar sharlagelfand commented on May 21, 2024

I've cleaned out the sandbox folder so it only has working specs.

from datamations.

sharlagelfand avatar sharlagelfand commented on May 21, 2024

Re: testing, there are a bunch of tests here that check the format / fields of the json on the R end. Definitely not 100% test coverage because of all the shiny, legacy code, etc, but a decent start on the core functionality:

Screen Shot 2021-11-18 at 4 04 47 PM

(the middle columns show lines, covered, missed, etc - but the last column is coverage for each file)

I'm still trying to think of the best way to compare the python vs R specs within the testthat framework (which is commonly used for R packages). If the python code can write specs to a json file, we can read those in, generate the R specs, and check that they're the same as a start!

from datamations.

jhofman avatar jhofman commented on May 21, 2024

sounds like a good idea on writing python json specs out to files and testing them w/ the R testthat framework.

@chisingh, let's work on this once python is up and running.

from datamations.

chisingh avatar chisingh commented on May 21, 2024

I have added unit tests using pytest framework that can also be enabled to run after every commit once issue #104 is closed. Some of these tests use the raw json files provided by @sharlagelfand to verify that both the outputs match.

from datamations.

jhofman avatar jhofman commented on May 21, 2024

@chisingh will output json specs from python and @sharlagelfand will read that in and test w/ testthat in R

from datamations.

sharlagelfand avatar sharlagelfand commented on May 21, 2024

Just working on testing those specs @chisingh and it looks like there are some discrepancies in ordering of things - in the R specs, meta comes before data, but in the python specs data comes first.

Similarly in the data.values, the order of fields do not match, e.g. in R:

"gemini_id": 20,
"Work": "Academia",
"datamations_x": 1,
"datamations_y": 85.0122219615483,
"datamations_y_tooltip": 85.0122219615483,
"datamations_y_raw": 85.3303201349918,
"Lower": 84.7637160761228,
"Upper": 85.2607278469738

versus in python:

"gemini_id": 20,
"Work": "Academia",
"datamations_x": 1,
"datamations_y": 85.01222196154829,
"datamations_y_raw": 85.33032013499178,
"datamations_y_tooltip": 85.01222196154829,
"Lower": 84.76371607612279,
"Upper": 85.2607278469738

The order of datamations_y_raw and datamations_y_tooltip are flipped here.

Otherwise the specs look equivalent! Just something it might be nice to keep in mind and change if not too big of a hassle, otherwise I will have to match the ordering before each test.

from datamations.

chisingh avatar chisingh commented on May 21, 2024

That's great! I will reorder those fields.

from datamations.

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.