title: Calling unit tests with arguments
body: <p>I'm looking for a way to parameterise unit tests for those cases that an input and its results change, but writing another test feels too tedious.</p>
  
  <p>Suppose the <code>str.isalnum</code> function is under test. One could write a case for every character.</p>
  
  <pre><code>class TestIsalnum(unittest.TestCase):
      def test_a(self):
          self.assertTrue('a'.isalnum())
  
      def test_dot(self):
          self.assertFalse('.'.isalnum())
  
      def test_comma(self):
          self.assertFalse(','.isalnum())
  </code></pre>
  
  <p>There should be an easier way. Lo and behold: there is, with this well-named function below designed to not get recognised by the automatic execution of tests when using <code>unittest.main()</code>.</p>
  
  <pre><code>class TestIsalnum(unittest.TestCase):
      def tessst_with_params(self, char: str, value: bool):
          self.assertEqual(char.isalnum(), value)
  
      def test_not_alphanumerics(self):
          chars = '.,_;*!'
  
          for char in chars:
              self.tessst_with_params(char, False)
  </code></pre>
  
  <p>All is well and the test is passed. But it's considered to be <em>one</em> test. Intuitively each call should be its own test case. Additionally, if one case fails, ones after are not executed and the traceback contains very little information.</p>
  
  <p>Is there an established way of writing such tests? If not, how should these kinds of tests be implemented?</p>
  
  <p>Having the functions on one line is a bit more concise, but I'm not sure about the style and elegance.</p>
  
  <pre><code>def test_dot(self): self.tessst_with_params('.', False)
  def test_comma(self): self.tessst_with_params(',', False)
  </code></pre>