-
-
Notifications
You must be signed in to change notification settings - Fork 556
etl: Add canonical data #507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
My initial thought is "no", but I'm willing to be convinced otherwise. The way I'm thinking of this is that we have a scrabble alphabet, and we're changing the structure of the tile => point mapping. If there are words (or multiple letters), that seems like a different problem. |
sounds good to me. i think i agree. the way the problem is stated is
related to the scrabble board. i'll update accordingly
Also... if it's any more support for leaving out the "word" tests, the majority of the existing tests *don't* test with words, only with letters.
…On Mon, Jan 23, 2017 at 8:01 PM, Katrina Owen ***@***.***> wrote:
My initial thought is "no", but I'm willing to be convinced otherwise.
The way I'm thinking of this is that we have a scrabble alphabet, and
we're changing the structure of the tile => point mapping.
If there are words (or multiple letters), that seems like a different
problem.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#507 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAaFdF30f99ZSGgslA8G_2Ham8aeFYfhks5rVXemgaJpZM4LrxIC>
.
|
@bunnymatic, some Pull Request tips:
|
Word tests should not be included. |
} | ||
}, | ||
{ | ||
"description": "tramsforms more values", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"transforms" is spelled incorrectly (multiple times).
I'd rather see more useful test descriptions.
"Transforms more values" is a possible description for all but one of these tests, what is this test actually testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll fix the typos. interestingly, the test descriptions are thin but consistently thin across the existing suites. I can beef them up. I was mimicking what i'd seen in the existing...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have an idea for the test descriptions? I started with something more like
transforms a map with a single key and an array of one value into a map with one key and one value
. That works for the first one, but the next ones get pretty wordy. Is that where you thought that might go?
If this file acted like I think of rspec describe/context/it blocks, the outer description could be kind of the prefix to the inner descriptions with something like
{
"transform": {
"description": "transforms the input map",
"cases": [
{
"description": "with one key that has an array with one value into a map with one key and one value",
"input": {"1": ["A"] },
"expected": { "a" : 1 }
},
{
"description": "with one key and multiple values into a map with multiple keys each with a single value",
"input": { "1": ["A", "E", "I", "O", "U" ] },
"expected": {
"a" : 1,
...
I'm happy to rewrite the descriptions, but i'd love a little direction or suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below for some suggestions.
"description": "transforms the input map from a map of value: [ keys ] to a map of key: value for each of the keys", | ||
"cases": [ | ||
{ | ||
"description": "transforms one value", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"single letter"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also be, "single score with a single letter"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Insti for all these. I think i'm getting it. I'll make updates accordingly
{ | ||
"description": "transforms more values", | ||
"input": { | ||
"1": ["A", "E", "I", "O", "U" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"multiple letters with the same score"
} | ||
}, | ||
{ | ||
"description": "transforms more keys", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"multiple scores with multiple letters"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there no test for "multiple scores with a single letter" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though it could be an interesting error/edge scenario, it doesn't fit in with the problem description which says we're dealing with scrabble tile scores. Because of scrabble rules, there is no case where one A tile is worth 1 and another is worth 2.
} | ||
}, | ||
{ | ||
"description": "transforms a full data set", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"multiple scores with differing numbers of letters"
@@ -0,0 +1,62 @@ | |||
{ | |||
"transform": { | |||
"description": "transforms the input map from a map of value: [ keys ] to a map of key: value for each of the keys", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prompting for a potential name of the method is not necessary, see: circular-buffer
It has a comment, and then the list of cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Despite having added the circular-buffer file, now I get to play devil's advocate: when the time comes to do #336, maybe someone will be unhappy that JSON files with only a single function-under-test have "cases" as a key under the top-level object, whereas those with multiple functions-under-test have "cases" in second-level objects.
But I have no particular reason to favour one way or the other until we come up with a proposed unified schema for all the JSON files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is the idea that this file could be used to generate a test suite, wouldn't you kind of need the method name to know how to invoke the method in the test call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way the function is invoked is very language specific and will need to be specified by the language anyway.
@petertseng makes some good points above and I am sympathetic to the idea that some kind of identifier for the name of the problem (or section of the problem) can be specified in the JSON.
until we come up with a proposed unified schema for all the JSON files.
👍
So I guess what you're doing here is fine for now.
"cases": [ | ||
{ | ||
"description": "transforms one value", | ||
"description": "transforms a single letter", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'transforms ' is redundant in all these descriptions.
375f814
to
734121f
Compare
This may look like a pile of new commits, it was a rebase on the most current master. Only the last commit is truly new. Just FYI |
@@ -38,7 +38,7 @@ | |||
} | |||
}, | |||
{ | |||
"description": "transforms the full set of scrabble tiles (multiple scores with differing numbers of letters)", | |||
"description": "the full set of scrabble tiles (multiple scores with differing numbers of letters)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That they are scrabble tiles is irrelevant and leads to overly verbose test names since many tracks construct the test name from the description.
"multiple scores with differing numbers of letters" should be sufficient to describe the test.
If any additional description about the problem is required it should be in the description.md
file
c7eedc7
to
ae2e713
Compare
updated that description and squished this to 1 commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems OK. One interesting observation about the keys of the input.
{ | ||
"description": "a single letter", | ||
"input": { | ||
"1": ["A"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that this is a "1":
(rather than 1:
) because JSON would only allow string keys in their objects.
Is it the case that languages will usually use integers as their keys? If so, perhaps a note saying so? Can put it on the same level as description
and cases
. No standard key for that note, for some reason people ahve used "#":
in the past, but maybe "notes":
is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also thought about this when I started this PR but then quickly got distracted with other changes. I'll add a note. I think it's an important thing to call out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked at several data files. Not a single one uses notes
. Though that is probably a better key (long term) I'm not sure this commit should be the one to start that. So I went with #
.
If there is some documentation that could be updated... and if you guys want (me) to build a script to update all #
entries with notes
to lay down the "new" convention. I'd be happy to help. but for now, i'm sticking with #
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @bunnymatic thanks for all the work on this and all the other ones you're working on.
I hope I'm not coming across as constantly critical.
I appreciate the work you're doing. ❤️
Nope. I get it. I can see how with a large open source project like this, you want to lay down the rules and patterns as much as possible and that's hard given the open source ness and the scope (all the different languages). I'm happy to help out. Hopefully the next ones will be closer to correct at the first commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
understood about "#" vs "notes", if we decide notes is the way of the future we can deal with it later.
Thanks @bunnymatic ❤️ |
* prime-factors: add canonical data (exercism#513) * etl: Add canonical data (exercism#507) Add ETL exercise canonical data
Someone can probably close https://github.com/exercism/todo/issues/90 now |
* Add test for `version` method. Added required fixture files. Added support for passing xruby root to constructor. * Add unit test for 'generate' method. * Test generate when metadata repository is missing * Add test for `test_cases` method Add sample canonical-data.json to fixture metadata * Add test for GitCommand.short_sha
After scouring the existing test suites, I noticed that a few of them [Python, for example] (https://github.com/exercism/xpython/blob/master/exercises/etl/etl_test.py) include keys that are not just single letters but words. I've included one extra case at the bottom that tests that case. Not sure if it's something we want to include here or not.