Comments (7)
The big question here is: how do you do unit tests on a Luigi Task? In the past, I offloaded the actual processing into a method in the Task class, then ran that on some dummy input. However, this seems a little silly and artificial. Could we come up with tests that work directly on a Task's run
method?
from chess-pipeline.
Something to look into: Great Expectations, a sort of testing library for your data, apparently.
from chess-pipeline.
Looks like Great Expectations was not really what I was expecting. Haha. I guess what I can do is set up some pytest
type framework and just init the Luigi Task
s and then pass custom input into them, then see what their output is. I'd have to make sure the output comes back inside the test, though, and not as a file - or maybe I could actually output it as files and then just verify inside the test by loading the file and seeing what the output is? I'm not exactly sure how this would work so it'll take some experimenting.
from chess-pipeline.
Looks like the best way to do this is by offloading "business logic" into functions that are called by luigi.Task
s, and then test those with a small data sample (probably via pytest
?).
I'll keep a list of things I need to offload here, as well as a list of tests to write.
from chess-pipeline.
Functions to write:
-
parse headersfade7ac -
provisional rating manipca50eaa -
sf evaluation filternot sure that this is needed -
clock time manip8ce3534 -
FEN manipd7df467 -
all the32b3861GetGameInfos
dataframe manipulation -
newsletter SQLcfc15e8 -
newsletter tables20392b0 , f451bef -
newsletter plots (test the fact that they worked? maybe md5 of saved image?)cdbac9f , df86077
from chess-pipeline.
Tests to write:
-
parse headers965face -
provisional rating manipbbbb1b3 -
clock time manip272f254 -
FEN manip8223b37 -
all the05b5feeGetGameInfos
dataframe manipulation -
newsletter SQLc5bce7a -
newsletter tables42bb4a8 , eac7e7f -
newsletter plots (test the fact that they worked? maybe md5 of saved image?)240b9dd , 8268527 -
visitors00f5993 -
column queries (mock with a .sqlite somehow?)skipping this for now -
stockfish evaluation (must fix to a specific version of stockfish)2b358c9 (testing on stockfish 10 working) -
sf evaluation filter
from chess-pipeline.
Got most of the tests written that I wanted to. I'm not sure what I meant by "sf evaluation filter" but at some point I'm sure it will come up.
I'm skipping the column query since it would require a more extensive rewrite and would probably require mocking the test with a .sqlite, which is a little bit more complicated than I'm willing to do right now, especially for such a simple SQL query.
Next step is setting up TravisCI or something similar, I guess.
from chess-pipeline.
Related Issues (20)
- Check if Maia is useful
- Add parameters for newsletter
- Rewrite SQL queries to use cursors in pandas HOT 1
- Change visitors to use attributes under `game.headers`
- Move stockfish analysis to its own Task
- Some table SQLs don't match actual tables HOT 2
- Set up testing on push / pull requests
- Fix visitor in header issues
- Remove duplicate FENs from `position_evals`
- `EloByWeekday` fails when no games HOT 3
- Add perftype to filenames to prevent unfulfilled dependency errors HOT 5
- Organize analysis code HOT 6
- Deploy win probability model HOT 5
- Set up staging environment
- WinRatioByColor fails when only one color played HOT 2
- Fix off-by-one data HOT 1
- Clean up GetEvals `explode()` calls
- Examine relative piece worth
- Fix EloByWeekday relying on other categories of games
- Minimize `GetEvals` footprint
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chess-pipeline.