Skip to content
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

atbash_cipher_test: Add 2 tests; leap: change all tests #406

Closed
wants to merge 2 commits into from
Closed

atbash_cipher_test: Add 2 tests; leap: change all tests #406

wants to merge 2 commits into from

Conversation

jgomo3
Copy link
Contributor

@jgomo3 jgomo3 commented Jan 26, 2017

Add test_decode_number as there is a test that encode number. Check this iteration[1] for a solution that pass the tests without checking for alphanumeric in decode.

Add test_encode_decode. Having done this in the first place, would had highlighted the need of checking for alphanumeric in decoding.

[1] http://exercism.io/submissions/c7c9448e6a674dd6a11ea35dc32e29a4

Add `test_decode_number` as there is a test that encode number. Check this _iteration_[1] for a solution that pass the tests without checking for alphanumeric in decode.

Add `test_encode_decode`. Having done this in the first place, would had highlighted the need of checking for alphanumeric in decoding.

[1] http://exercism.io/submissions/c7c9448e6a674dd6a11ea35dc32e29a4
Predicate functions shouldn't convert its implementation based on
logic expressions (combinations of `not`, `and` and `or`).

I.e. The following should be correct:

    def is_NOT_divisible_by_4(n):
        return n % 4

    assert is_NOT_divisible_by_4(10)

But as the TestCases for this exercise are using `assertIs(..., True)
instead of `assertTrue(...)`, implementations cointing on the numbers
behaviour on boolean contexts will Fail.

What this mean, is that for the given definition of
`is_NOT_divisible_by_4`, the folloging assertion will Fail:

    assert is_NOT_divisible_by_4(10) == True

I think it is meaningless to check for `True` as it is naive to write:

    if predicate(x) == True:
        do_something(x)

Instead of:

    if predicate(x):
        do_something(x)
@jgomo3 jgomo3 changed the title atbash_cipher_test: Add 2 tests atbash_cipher_test: Add 2 tests; leap: change all tests Feb 1, 2017
@behrtam
Copy link
Contributor

behrtam commented Feb 22, 2017

Great changes! Would it be possible to split them, so that we have one PR per exercise?

@jgomo3
Copy link
Contributor Author

jgomo3 commented Feb 22, 2017

Sure. What do you suggest?
Should this PR be cancelled and I should create 2 branches, one with only one commit for each change, and make a PR for each one? Or is there a better way?

@behrtam
Copy link
Contributor

behrtam commented Feb 22, 2017

I don't know an easier way than to create two new branches/prs.

@jgomo3
Copy link
Contributor Author

jgomo3 commented Feb 22, 2017

I created 2 separate pull requests, one for each commit in this one. They are:

#418 and #419.

@jgomo3 jgomo3 closed this Feb 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants