(self)
| 395 | eq(baseindent(), test.indent) |
| 396 | |
| 397 | def test_is_block_opener(self): |
| 398 | yes = self.assertTrue |
| 399 | no = self.assertFalse |
| 400 | p = self.parser |
| 401 | setcode = p.set_code |
| 402 | opener = p.is_block_opener |
| 403 | |
| 404 | TestInfo = namedtuple('TestInfo', ['string', 'assert_']) |
| 405 | tests = ( |
| 406 | TestInfo('def a():\n', yes), |
| 407 | TestInfo('\n def function1(self, a,\n b):\n', yes), |
| 408 | TestInfo(':\n', yes), |
| 409 | TestInfo('a:\n', yes), |
| 410 | TestInfo('):\n', yes), |
| 411 | TestInfo('(:\n', yes), |
| 412 | TestInfo('":\n', no), |
| 413 | TestInfo('\n def function1(self, a,\n', no), |
| 414 | TestInfo('def function1(self, a):\n pass\n', no), |
| 415 | TestInfo('# A comment:\n', no), |
| 416 | TestInfo('"""A docstring:\n', no), |
| 417 | TestInfo('"""A docstring:\n', no), |
| 418 | ) |
| 419 | |
| 420 | for test in tests: |
| 421 | with self.subTest(string=test.string): |
| 422 | setcode(test.string) |
| 423 | test.assert_(opener()) |
| 424 | |
| 425 | def test_is_block_closer(self): |
| 426 | yes = self.assertTrue |
nothing calls this directly
no test coverage detected