Skip to content

Use self.assertIn in our unit tests #1006

Closed

Description

@peterjc

Until recently we supported Python 2.6, where the unittest library did not support the self.assertIn(search_term, thing_to_search) method meaning we used self.assertTrue(search_term in thing_to_search) instead, often with a message term.

I fixed a couple just now where there was a TODO comment: 0da3844

There are over 200 of these examples remaining, e.g.

$ cd Tests/
$ grep assertTrue *.py | grep " in "
common_BioSQL.py:        self.assertTrue("biosql-test" in server)
common_BioSQL.py:        self.assertTrue("biosql-test2" in server)
common_BioSQL.py:        self.assertTrue("biosql-test" in server)
...

Fixing these by hand would be extremely tedious, but with a little regular expression knowledge you can probably do this in one line of awk or perl etc. Or write a Python script to do it?

Activity

  1. added
    good first issue
    on Nov 23, 2016
  2. souravsingh commented on Nov 23, 2016

    @souravsingh
    Contributor

    I would like to take a stab at the issue

  3. peterjc commented on Nov 24, 2016

    @peterjc
    MemberAuthor

    Great - if you can solve this using awk or a similar approach, it would be great if you could post your solution here too.

  4. added a commit that references this issue on Dec 9, 2016
    0f5997c
  5. added a commit that references this issue on Dec 9, 2016
    fa6d2e7
  6. added a commit that references this issue on Oct 31, 2017
    540d367
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

    Testinggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions