Comments (5)
What we note is that with unit tests we cannot cover every cases.
And it's easier to create fixtures than create model.
But if a piece of code need to be unit tested and has a value, we "unit test" it.
from transit_model.
Edit: sorry @datanel didn't saw your reply before posting π
I think a model creation is way easier to understand than fixture (but fixture are really useful too!).
Unit tests are not really great for parsing NTFS/GTFS/Netex, but I think they could be a great asset business logic like transfer creation, merging (and real time applying π )
I'll try to make a proposal.
What do you think of:
let model = ModelBuilder::default()
.vj("toto", |vj_builder| {
vj_builder
.st("A", "10:00:00".into(), "10:01:00".into())
.make_st("B", "11:00:00".into(), "11:01:00".into(), |mut st| { // <-- could a stop creation with total access to the object be useful for complex initialization ?
st.boarding_duration = 12;
})
})
// .vj(...)
.build();
We could also go for something with less lambda (but then it cannot be chained):
let mut builder = ModelBuilder::default();
builder
.vj("toto")
.st("A", "10:00:00".into(), "10:01:00".into())
.make_st("B", "11:00:00".into(), "11:01:00".into(), |mut st| {
...
});
// builder.vj(...);
let model = builder.build();
what do you think ? do you see better/simplier api ?
from transit_model.
why you cannot chain in the 2nd proposition if you always return a builder?
from transit_model.
because .vj(..)
will return a VJBuilder
and not a builder (to mutate the current vj
)
we could return a Builder
and make .sa(...)
work on the last vj
but I'm not a fan of such implicit stuff
from transit_model.
Some work still need to be done, but it's usable for the moment, I think we can close this
from transit_model.
Related Issues (20)
- merge-ntfs HOT 2
- gtfs2ntfs : new way to generate prefixes ? HOT 4
- better object duplicate error HOT 4
- Error reading "./ntfs/feed_infos.txt" HOT 3
- Add more flexibility to read inputs HOT 1
- [tech] Easier hello world HOT 8
- Allow reading GTFS csv files with a flexible option for columns number HOT 2
- Do gtfs2netexfr handle the pathways and levels GTFS extensions ? HOT 1
- FR: prefixes dans les id HOT 4
- CoordonnΓ©es WGS HOT 5
- SiteConnection id not unique HOT 2
- [tech] Improve ignored doc-tests
- [gtfs2netexfr] Help needed to pinpoint cause of "unused lines" pruning HOT 3
- transit_model fails to open zipped file. HOT 8
- TransXChange format HOT 1
- ODT : incorrect behavior ? HOT 10
- Problem with cargo install --path gtfs2netexfr HOT 4
- gtfs2netexfr : wrong StopPlaceType for bus HOT 5
- Dependency minidom 0.12 HOT 1
- Any plans to integrate the latest GTFS specifications ? HOT 1
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 transit_model.