Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Autodoc

 Autodoc

Py-Autodoc

heavenshell

March 13, 2014
Tweet

More Decks by heavenshell

Other Decks in Programming

Transcript

  1. ͓·͑ɺ୭Α Software engineer, Programmer py-qiita, py-jokk, vim-pydocstring, vim-jsdoc, vim- connpass,

    etc — Python, Vim, Vimperator PHP, Perl, Java, JavaScript ޷͖ͳ Python ͷඪ४ؔ਺͸ print() ͱ dir() 14೥3݄14೔༵ۚ೔
  2. from unittest import TestCase from webtest import TestApp from autodoc

    import autodoc from tests.app import create_app class TestUnittest(TestCase): def setUp(self): app = create_app self.client = TestApp(app) @classmethod @autodoc.generate('var/test_unittest.rst') def tearDownClass(cls): pass @autodoc.describe('POST /foo/bar') def test_foo_bar(self): """ POST /foo/bar """ param = {'id': 1, 'message': 'foo'} res = self.client.post_json('/foo/bar', params=param) self.assertEqual(res.status_code, 200) return res 14೥3݄14೔༵ۚ೔
  3. from unittest import TestCase from webtest import TestApp from autodoc

    import autodoc from tests.app import create_app class TestUnittest(TestCase): def setUp(self): app = create_app self.client = TestApp(app) @classmethod @autodoc.generate('var/test_unittest.rst') def tearDownClass(cls): pass @autodoc.describe('POST /foo/bar') def test_foo_bar(self): """ POST /foo/bar """ param = {'id': 1, 'message': 'foo'} res = self.client.post_json('/foo/bar', params=param) self.assertEqual(res.status_code, 200) return res 14೥3݄14೔༵ۚ೔
  4. from unittest import TestCase from webtest import TestApp from autodoc

    import autodoc from tests.app import create_app class TestUnittest(TestCase): def setUp(self): app = create_app self.client = TestApp(app) @classmethod @autodoc.generate('var/test_unittest.rst') def tearDownClass(cls): pass @autodoc.describe('POST /foo/bar') def test_foo_bar(self): """ POST /foo/bar """ param = {'id': 1, 'message': 'foo'} res = self.client.post_json('/foo/bar', params=param) self.assertEqual(res.status_code, 200) return res 14೥3݄14೔༵ۚ೔
  5. from unittest import TestCase from webtest import TestApp from autodoc

    import autodoc from tests.app import create_app class TestUnittest(TestCase): def setUp(self): app = create_app self.client = TestApp(app) @classmethod @autodoc.generate('var/test_unittest.rst') def tearDownClass(cls): pass @autodoc.describe('POST /foo/bar') def test_foo_bar(self): """ POST /foo/bar """ param = {'id': 1, 'message': 'foo'} res = self.client.post_json('/foo/bar', params=param) self.assertEqual(res.status_code, 200) return res 14೥3݄14೔༵ۚ೔
  6. import sys import pytest from webtest import TestApp from autodoc

    import autodoc @autodoc.generate('var/test_pytest.md', template='templates/markdown.md') def teardown_module(module): pass @autodoc.describe('GET /') def test_index(): app = TestApp(create_app) res = app.get('/') assert res.status_code == 200 return res 14೥3݄14೔༵ۚ೔
  7. import sys import pytest from webtest import TestApp from autodoc

    import autodoc @autodoc.generate('var/test_pytest.md', template='templates/markdown.md') def teardown_module(module): pass @autodoc.describe('GET /') def test_index(): app = TestApp(create_app) res = app.get('/') assert res.status_code == 200 return res 14೥3݄14೔༵ۚ೔
  8. import sys import pytest from webtest import TestApp from autodoc

    import autodoc @autodoc.generate('var/test_pytest.md', template='templates/markdown.md') def teardown_module(module): pass @autodoc.describe('GET /') def test_index(): app = TestApp(create_app) res = app.get('/') assert res.status_code == 200 return res 14೥3݄14೔༵ۚ೔
  9. import sys import pytest from webtest import TestApp from autodoc

    import autodoc @autodoc.generate('var/test_pytest.md', template='templates/markdown.md') def teardown_module(module): pass @autodoc.describe('GET /') def test_index(): app = TestApp(create_app) res = app.get('/') assert res.status_code == 200 return res 14೥3݄14೔༵ۚ೔
  10. ੍໿ ඞͣςετϝιου/ؔ਺Ͱ WebTest ͷϨεϙϯεΛ Ԡ౴͢Δඞཁ͋Γ Ruby ͷ autodoc ͸ Rack-Test

    Λ࢖͏ͱ last_response ͔ΒϨεϙϯεΛऔಘͯ͠Δ͚ͲɺWebTest ʹͦΜͳ ͷ͸ແ͍ͷͰ return ͯ͠ड͚औΔ࢓༷ Flask(ͱ͍͏͔Werkzueg)ͷςετΫϥΠΞϯτ΋ର Ԡ͠Α͏͔ͱࢥ͚ͬͨͲɺResponse ʹ Request Φϒ δΣΫτ͕֨ೲ͞Εͯͳ͍ͷͰμϝͩͬͨ 14೥3݄14೔༵ۚ೔