Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 457 Bytes

PT009.md

File metadata and controls

30 lines (20 loc) · 457 Bytes

PT009

use a regular assert instead of unittest-style '{assertion}'

Examples

Bad code:

import unittest

class TestFoo(unittest.TestCase):
    def test_foo(self):
        self.assertEqual(a, b)

Good code:

import unittest

class TestFoo(unittest.TestCase):
    def test_foo(self):
        assert a == b

Rationale

  • to enforce the assertion style recommended by pytest
  • to make use of pytest's assertion rewriting