python

Python メモ

tk3
Python でスクリプトを書いていたときのメモ。 markdown frontmatter pip install python-frontmatter import frontmatter post = frontmatter.load(file) print(post['title']) print(post.content) assertion - unit test unittest — Unit testing framework — Python 3.10.1 documentation assertEqual(a, b) assertNotEqual(a, b) assertTrue(x) assertFalse(x) assertIs(a, b) assertIsNot(a, b) assertIsNone(x) assertIsNotNone(x) assertIn(a, b) assertNotIn(a, b) assertIsInstance(a, b) assertNotIsInstance(a, b) unit test ベース from unittest import TestCase class TestFoo(TestCase): def setUp(self) -> None: print("setup") def tearDown(self) -> None: print("tearDown") def test_function(self): self.