Visitar URL original
Improve exception tests · Issue #477 · exercism/python · GitHub
Skip to content

Improve exception tests #477

Description

@behrtam

Maybe we should change the way we test exceptions (see #476) to always use a context manger as this way is easier to understand.

def test_it(self):
    self.assertRaises(SomeException, do_something, 42, True)

def test_it_with_context(self):
    with self.assertRaises(SomeException):
        do_something(42, True)

Steps

  • update old tests
  • document this in the readme for new exercises

Activity

  1. cmccandless commented on Oct 5, 2017

    @cmccandless
    Contributor

    I like the idea; it improves readability significantly.

    Maybe we could take advantage of the Hacktoberfest momentum and create another wave of issues for this?

  2. ilya-khadykin commented on Oct 5, 2017

    @ilya-khadykin
    Contributor

    good idea, @cmccandless!
    It would be somewhat hard to create a list of all affected exercises I think

  3. cmccandless commented on Oct 5, 2017

    @cmccandless
    Contributor

    I can begin to make a list.

  4. ilya-khadykin commented on Oct 5, 2017

    @ilya-khadykin
    Contributor

    @cmccandless that would be awesome!

    Once we have a list we can create separate issues for each exercise

  5. cmccandless commented on Oct 5, 2017

    @cmccandless
    Contributor
  6. cmccandless commented on Oct 17, 2017

    @cmccandless
    Contributor

    As there is already a large amount of pull issues and pull requests designated for Hacktoberfest, I went ahead and created a single pull request for this (#945).

  7. ilya-khadykin commented on Oct 17, 2017

    @ilya-khadykin
    Contributor

    @cmccandless, wow, thanks a lot and sorry for the delay in review

  8. added a commit that references this issue on Oct 21, 2017
    f8f495c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions