How to Write Robust Python Code
by
HayaoSuzuki
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
ݎ࿚ͳ Python ίʔυΛॻ͘ํ๏ ʰϩόετ PythonʱΛಡ͏ Hayao Suzuki BPStudy#189 May 29, 2023
Slide 2
Slide 2 text
Who am I ? ͓લ୭Α ໊લ Hayao Suzukiʢླɹॣʣ Twitter @CardinalXaro ࣄ Software Developer @ BeProud Inc. › גࣜձࣾϏʔϓϥυ › IT ษڧձࢧԉαʔϏε connpass › ΦϯϥΠϯֶशαʔϏε PyQ › γεςϜ։ൃͷͨΊͷυΩϡϝϯταʔϏε Tracery › 2023 5 ݄ 23 ʹཱ 17 पΛܴ͑ͨ 2 / 46
Slide 3
Slide 3 text
Who am I ? ༁ٕͨ͠ज़ॻ › ϩόετ Python(O’Reilly Japan) New! › ೖ Python 3 ୈ 2 ൛ (O’Reilly Japan) ࠪಡٕͨ͠ज़ॻʢൈਮʣ › Effective Python ୈ 2 ൛ (O’Reilly Japan) › ϚΠΫϩϑϩϯτΤϯυ (O’Reilly Japan) › ϚΠΫϩαʔϏεΞʔΩςΫνϟ ୈ 2 ൛ (O’Reilly Japan) › SQL Ͱ͡ΊΔσʔλੳ (O’Reilly Japan) New! https://xaro.hatenablog.jp/ ʹϦετ͕͋Γ·͢ɻ 3 / 46
Slide 4
Slide 4 text
Who am I ? ൃදϦετʢൈਮʣ › ϨΨγʔ Django ΞϓϦέʔγϣϯͷݱԽ (DjangoCongress JP 2018) › SymPy ʹΑΔࣜॲཧ (PyCon JP 2018) › Python ͱָ͠Ήॳ (PyCon mini Hiroshima 2019) › ܅ cmath Λ͍ͬͯΔ͔ (PyCon mini Shizuoka 2020) › ΠϯϝϞϦʔετϦʔϜ׆༻ज़ (PyCon JP 2020) › ΈࠐΈؔ pow ͷΒΕ͟ΔਐԽ (PyCon JP 2021) https://xaro.hatenablog.jp/ ʹϦετ͕͋Γ·͢ɻ 4 / 46
Slide 5
Slide 5 text
ࠓͷςʔϚ ݪஶʰRobust Pythonʱ ஶऀ Patrick Viafore ग़൛ࣾ O’Reilly Media ൃߦ 2021 7 ݄ ༁ʰϩόετ Pythonʱ ༁ऀ ླ ॣ ༁ɺඌ ߴ߂ ༁ ग़൛ࣾ O’Reilly Japan ൃߦ 2023 3 ݄ ඌ͞ΜɺླͷϖΞʰೖ Python 3 ୈ 2 ൛ʱҎདྷ 2 ճ 5 / 46
Slide 6
Slide 6 text
ࠓͷςʔϚ ʰϩόετ PythonʱΛಡ͏ › ͬ͟ͱɺͲΜͳࣄ͕ॻ͍ͯ͋Δͷ͔հ͠·͢ › 384 ϖʔδͷ༰Λ 30 ͰಡΜͩؾʹͳΖ͏ʂ 6 / 46
Slide 7
Slide 7 text
ϩόετ Python ͷߏ 4 ෦ߏ ୈ I ෦ ܕΞϊςʔγϣϯ ୈ II ෦ Ϣʔβఆٛܕ ୈ III ෦ େنͳมߋͷରԠ ୈ IV ෦ ηʔϑςΟωοτͷߏங ͳ͓ɺୈ 1 ষʮϩόετ Python ೖʯಋೖͱͳΔষ 7 / 46
Slide 8
Slide 8 text
ैདྷͷٕज़ॻͱͷҧ͍ Python ͱܕώϯτ › ܕώϯτ Python 3.5 ͰಋೖʢPEP 484ʣ › Python 3.5 2015 9 ݄ʹϦϦʔε ܕώϯτͷ͚ํ͢ͰʹͬͯΔΑ › ܕώϯτͷ͚ํͷղઆهࣄॻ੶ଟ͍ʢ8 ͷੵʣ › ܕώϯτͷӡ༻ํ๏ߟ͑ํʹ౿ΈࠐΜͩຊଘࡏ͢Δͷ͔ ͦͦɺதڃऀҎ্͚ͷ Python ຊͷઈର͕গͳ͍ΑͶ 8 / 46
Slide 9
Slide 9 text
ϩόετ Python ͷ͕͍͜͜͢͝ ϩόετ Python ͷಛ › ܕώϯτʹ͍ͭͯ 14 ষʹΘͨͬͯৄࡉʹղઆʢୈ I ෦ɺୈ II ෦ʣ › ϩόετͳઃܭʢୈ III ෦ʣ › ܕώϯτܕ͚ͩͰΧόʔ͖͠Εͳ͍ཁૉରԠʢୈ IV ෦ʣ 9 / 46
Slide 10
Slide 10 text
ϩόετ Python ͷओ ʰϩόετ Pythonʱ͕ݴ͍͍ͨ͜ͱ › σʔλܕͱίϛϡχέʔγϣϯखஈͰ͋Δ › ͕ࣗίʔυͰදݱ͍ͨ͜͠ͱΛσʔλܕΛͬͯ໌֬ʹ͑Α͏ 10 / 46
Slide 11
Slide 11 text
ୈ 1 ষ ϩόετ Python ೖ ϩόετ Python ͬͯͲΜͳຊ ཁ͢Δʹɺຊॻϩόετʢؤৎ/ؤ݈/ݎ࿚ʣͳ Python Λॻͨ͘ΊͷຊͰ͋Δɻ ʢP. 1ʣ ͦͦϩόετͬͯԿʁ ίʔυϕʔεͷϩόετωεͱɺઈ͑ͣมԽͯ͠ٱੑ͕ߴ͘ɺΤϥʔΛى͜͞ͳ ͍͜ͱͰ͋Δɻ ʢP. 4ʣ 11 / 46
Slide 12
Slide 12 text
ୈ 1 ষ ϩόετ Python ೖ ͳͥϩόετʹ͢Δඞཁ͕͋Δͷ͔ʁ ͦͷ͑ͷ֩৺ίϛϡχέʔγϣϯʹ͋Δɻ ʢதུʣͦͷͨΊʹɺকདྷͷϝϯςφ ͱձΘͳͯࣗ͘ͷڌͱҙਤ͕ΘΔΑ͏ʹ͍ͨ͠ɻ 12 / 46
Slide 13
Slide 13 text
ୈ 1 ষ ϩόετ Python ೖ ྫɿ ԿΛ͢ΔؔͰ͠ΐ͏͔ʁ def adjust_recipe(recipe, servings): old_servings = recipe.pop(0) factor = servings / old_servings # ؆୯ʹܭଌͰ͖Δ͚ͩΛ͍ͬͯͩ͘͞ new_recipe = {ingredient: (amount * factor, unit) for ingredient, amount, unit in recipe} new_recipe["servings"] = servings return new_recipe 13 / 46
Slide 14
Slide 14 text
ୈ 1 ষ ϩόετ Python ೖ ίϛϡχέʔγϣϯͷྨ ۙੑ ใͷൃ৴ऀͱड৴ऀͷؒʹ͋Δ࣌ؒతͳڑ ίετ ίϛϡχέʔγϣϯʹඞཁͳ࿑ྗ 14 / 46
Slide 15
Slide 15 text
ୈ 1 ষ ϩόετ Python ೖ ͳͥϩόετʹ͢Δඞཁ͕͋Δͷ͔ʁ ͦͷ͑ͷ֩৺ίϛϡχέʔγϣϯʹ͋Δɻ ʢதུʣͦͷͨΊʹɺকདྷͷϝϯςφ ͱձΘͳͯࣗ͘ͷڌͱҙਤ͕ΘΔΑ͏ʹ͍ͨ͠ɻ ͦͷͨΊʹʁ ະདྷͷϝϯςφʹҙਤΛ͑ΔʹɺίετͰۙੑ͕ෆཁͳίϛϡχέʔγϣϯ͕ ඞཁͰ͋Δɻ 15 / 46
Slide 16
Slide 16 text
ୈ 1 ষ ϩόετ Python ೖ ίετͰۙੑ͕ෆཁͳίϛϡχέʔγϣϯ › ίʔυΛಡΉ͚ͩͰཧղͰ͖ΕΑ͍ › ίʔυΛཧղ͢Δͷʹඞཁͳ࣌ؒΛ࠷খݶʹ͍͑ͨ ͦͷͨΊʹʁ σʔλܕͷબকདྷͷ։ൃऀʹରͯࣗ͠ͷҙਤΛදݱ͢Δ͜ͱͰ͋Γɺਖ਼͍͠σʔ λܕΛબ͢Εอकੑ্͕͢Δɻ ʢP. 19ʣ 16 / 46
Slide 17
Slide 17 text
ୈ 1 ষ ϩόετ Python ೖ ྫɿ ԿΛ͢ΔؔͰ͠ΐ͏͔ʁ from fractions import Fraction def adjust_recipe(recipe: Recipe, servings: int) -> Recipe: # ࡐྉσʔλͷίϐʔΛ࡞Δ new_ingredients = list(recipe.get_ingredients()) recipe.clear_ingredients() for ingredient in new_ingredients: ingredient.adjust_proportion( Fraction(servings, recipe.servings) ) return Recipe(servings, new_ingredients) 17 / 46
Slide 18
Slide 18 text
ୈ I ෦ ܕΞϊςʔγϣϯ 2 ষ Python σʔλܕೖ › Python ڧ͍ܕ͚ݴޠ › Python ಈతܕ͚ݴޠ ಈతܕ͚ݴޠຊ࣭తʹϩόετͰͳ͍ͷ͔ › ಈతܕ͚ݴޠͰϩόετʹॻ͚Δɺগ͠େมͳ͚ͩ › ੩తܕ͚ݴޠͷ߹ΑΓΑ͘ߟ͑Δඞཁ͕͋Δ › ੩తܕ͚ݴޠΛ͑ඞͣ͠ϩόετʹॻ͚ΔΘ͚Ͱͳ͍ 18 / 46
Slide 19
Slide 19 text
ୈ I ෦ ܕΞϊςʔγϣϯ 3 ষ ܕΞϊςʔγϣϯ › ܕώϯτͷߏจతͳ͚ํ͍ͬͯΔΑͶʢ8 ͷੵʣ › ܕώϯτπʔϧʢmypy ͳͲʣͱΈ߹ΘͤͯਅՁΛൃش͢Δ ܕώϯτ mypy λμͰͳ͍ › ެ։ APIɺϥΠϒϥϦͷΤϯυϙΠϯτ › ෳࡶͳܕɺΘ͔Γʹ͍͘ܕ › mypy ઌੜͷࢦࣔʹै͏ 19 / 46
Slide 20
Slide 20 text
ୈ I ෦ ܕΞϊςʔγϣϯ 4 ষ ܕ੍ › Optional Ͱ͵ΔΆόάΛ௵ͦ͏ › Union ͰදݱՄೳͳঢ়گΛݮͦ͏ › Literal Ͱ͞Βʹ੍Λ͔͚Α͏ › Final ͰఆͰ͋Δͱओு͠Α͏ › NewType ͰજࡏతͳόάΛ௵ͦ͏ Annotated ͷ͜ͱɺ࣌ʑͰ͍͍͔Βɺࢥ͍ग़͍ͯͩ͘͠͞ › ҙͷϝλσʔλΛՃͰ͖Δ͕ɺ୯ͳΔϝλσʔλ › ઐ༻ͷπʔϧ͕Ͱ͖ͨΒ͘ͳΔ͔ 20 / 46
Slide 21
Slide 21 text
ୈ I ෦ ܕΞϊςʔγϣϯ ྫɿ දݱՄೳͳঢ়ଶԿ௨Γʁ @dataclass class Snack: name: str # 3 ௨Γ condiments: set[str] # 4 ௨Γ error_code: int # 6 ௨Γʢޭ͕ 0 Τϥʔ͕ 1 ͔Β 5ʣ disposed_of: bool # 2 ௨Γ snack = Snack("Hotdog", {"Mustard", "Ketchup"}, 5, False) ͑ɿ3 ˆ 4 ˆ 6 ˆ 2 = 144 ௨ΓɻNone ڐ༰͢Δͱʁ 21 / 46
Slide 22
Slide 22 text
ୈ I ෦ ܕΞϊςʔγϣϯ ྫɿ දݱՄೳͳঢ়ଶԿ௨Γʁ @dataclass class Snack: name: str # 3 ௨Γ condiments: set[str] # 4 ௨Γ @dataclass class Error: error_code: int # 5 ௨ΓʢޭύλʔϯΛऔΓআ͚Δʣ disposed_of: bool # 2 ௨Γ snack: Union[Snack, Error] = Snack("Hotdog", {"Mustard", "Ketchup"}) ͑ɿ3 ˆ 4 + 5 ˆ 2 = 22 ௨Γɻ 22 / 46
Slide 23
Slide 23 text
ୈ I ෦ ܕΞϊςʔγϣϯ 5 ষ ίϨΫγϣϯܕ › ಉछίϨΫγϣϯͱҟछίϨΫγϣϯͷ֓೦Λཧղ͠Α͏ ಉछίϨΫγϣϯ ֨ೲ͞Εͨͯ͢ͷ͕ಉ͡σʔλܕͰ͋ΔίϨΫγϣϯ ҟछίϨΫγϣϯ ҟͳΔσʔλܕΛؚΉίϨΫγϣϯ 23 / 46
Slide 24
Slide 24 text
ୈ I ෦ ܕΞϊςʔγϣϯ యܕతͳྫɿJSON Λࣙॻʹม͢Δ › dict[str, Union[str, int, float, None]] ͷΑ͏ͳܕॻ͖ͨ͘ͳ͍ʂ › dict[str, Any] Ͱܕώϯτ͕ܗͳͩ͠ʂ ͦΜͳ࣌ TypedDict ܕώϯτΛଂͨࣙ͠ॻ ͦΜͳ࣌ dataclass ࣗͰ JSON ͷܗࣜΛ੍ޚͰ͖ΔͳΒ dataclass ͕Α͍ɻ 24 / 46
Slide 25
Slide 25 text
ୈ I ෦ ܕΞϊςʔγϣϯ 6 ষ ܕνΣοΧͷΧελϚΠζ › mypy Ͱ Optional None ʹؔ͢ΔνΣοΫΛ༗ޮʹ͢Δͱྑ͍Α › mypy ͕͍ʁ ͳΒσʔϞϯϞʔυϦϞʔτΩϟογϡͰߴԽ͠Α͏ ܕνΣοΧ mypy ͚ͩ͡Όͳ͍ Pyre Facebook ɺ੩తղੳπʔϧ Pysa ͍ͭͯ͘Δ Pyright Microsoft ɺVSCode ֦ுͷ Pylance ͷϕʔε 25 / 46
Slide 26
Slide 26 text
ୈ I ෦ ܕΞϊςʔγϣϯ 7 ষ ࣮ફతͳܕνΣοΫͷಋೖ ϖΠϯϙΠϯτΛಛఆͯ͠ίετΛ͔͚ա͗ͣʹܕώϯτΛ͍ΕΑ͏ ·͔ͣ͜͜Β › ৽نίʔυͷΈܕώϯτ › ϘτϜΞοϓʢϢʔςΟϦςΟɺϥΠϒϥϦʣʹܕώϯτ › རӹΛੜΈग़͢ϏδωεϩδοΫʹܕώϯτ › Α͘ॻ͖͑Δॴʹܕώϯτ › ෳࡶͳ෦ʹܕώϯτ › MonkeyType Pytype Ͱࣗಈతʹ༩༗ޮ͔ 26 / 46
Slide 27
Slide 27 text
ୈ II ෦ Ϣʔβఆٛܕ 8 ষ ྻڍܕ ੩తͳͷίϨΫγϣϯ͔ΒΛ 1 ͚ͭͩදݱ͍ͨ͠߹ʹ͏ ྻڍܕͷΞϯνύλʔϯ › ಈతʹ͕มԽ͢ΔྻڍܕɻࣙॻΛ͓͏ɻ › IntEnum IntFlag ޙํޓੑͷͨΊʹ͏ɻ৽نʹ͏ͷόάͷݩɻ 27 / 46
Slide 28
Slide 28 text
ୈ II ෦ Ϣʔβఆٛܕ 9 ষ σʔλΫϥε Python ͷੈքΛେ͖͘ม͑ͨσʔλΫϥεʢݪஶऀҰԡ͠ʣ σʔλΫϥεͷ͍Ͳ͜Ζ › ҟछίϨΫγϣϯσʔλΫϥεɺࣙॻಉछίϨΫγϣϯ › TypedDict ͱσʔλΫϥεɺ·ͣσʔλΫϥεΛݕ౼͠Α͏ › namedtuple ޙํޓੑͷͨΊʹ͏ σʔλΫϥεສೳͳͷ͔ʁ › σʔλΫϥεଐੑಉ͕࢜ಠཱ͍ͯ͠Δ߹ͷΈ༗ޮ 28 / 46
Slide 29
Slide 29 text
ୈ II ෦ Ϣʔβఆٛܕ 10 ষ Ϋϥε › ܅Ϋϥεͷຊͷ͍Ͳ͜ΖΛ͍ͬͯΔ͔ › ΫϥεͱɺෆมࣜͰ͋Δʢචऀͷςʔθʣ 29 / 46
Slide 30
Slide 30 text
ୈ II ෦ Ϣʔβఆٛܕ 11 ষ ΠϯλϑΣʔε › ͍͍͢ΠϯλϑΣʔεͱ › ͜ͷষ؍೦తͰ͋Δ ͍͍͢ΠϯλϑΣʔεΛٴ͢Δ › ར༻ऀͷΑ͏ʹߟ͑ΔʢTDDɺREADME ۦಈ։ൃɺϢʔβϏϦςΟςετʣ › ಛघϝιουɺίϯςΩετϚωʔδϟͷ׆༻ 30 / 46
Slide 31
Slide 31 text
ୈ II ෦ Ϣʔβఆٛܕ 12 ষ ෦ܕ › ܧঝஔՄೳੑʢLiskov ͷஔݪଇʣʹҙ͢Δ › ܧঝΑΓίϯϙδγϣϯʢ߹ʣ ਖ਼ํܗํܗ͔ʁ › ֶతʹɺਖ਼ํܗํܗͰ͋Δɻ › ਖ਼ํܗΛํܗͷܧঝͱͯ͠ද͢ͱഁ͢Δɻ ɿਖ਼ํܗͱํܗͷఆٛΛड़Αɻ·ͨɺ໋ʮਖ਼ํܗํܗͰ͋ΔʯΛਖ਼ํܗͱ ํܗͷఆٛʹج͍ͮͯূ໌ͤΑɻ 31 / 46
Slide 32
Slide 32 text
ୈ II ෦ Ϣʔβఆٛܕ 13 ষ ϓϩτίϧ › ੩తܕνΣοΧͷ݀ΛຒΊΔଘࡏ › μοΫλΠϐϯάͱ੩తܕνΣοΧΛͭͳ͙ϓϩτίϧ › ߏత෦ܕͱ໊త෦ܕΛͭͳ͙ϓϩτίϧ 32 / 46
Slide 33
Slide 33 text
ୈ II ෦ Ϣʔβఆٛܕ ߏత෦ܕɿσʔλܕͷߏΛجૅͱ͢Δ෦ܕ class ShuffleIterator: def __iter__(self): ... def __next__(self): ... ໊త෦ܕɿσʔλܕͷ໊લΛجૅͱ͢Δ෦ܕ class ShuffleIterator(Iterator): ... 33 / 46
Slide 34
Slide 34 text
ୈ II ෦ Ϣʔβఆٛܕ 14 ষ pydantic ʹΑΔ࣮ߦ࣌ܕνΣοΫ › ੩తܕνΣοΧͷ݀ΛຒΊΔଘࡏ › ࣗવʹೖྗͳͲΛνΣοΫͰ͖Δ pydantic ύʔεϥΠϒϥϦͰ͋Δ › int ͳΒ “123” 5.5 int ʹม͢Δ › StrictInt ͳͲΛ͏ඞཁ͋Δ͔ 34 / 46
Slide 35
Slide 35 text
ୈ III ෦ େنͳมߋͷରԠ 15 ষ ֦ுੑ › ֦ுੑͱɺγεςϜͷطଘ෦Λมߋͤͣʹ৽ػೳΛՃͰ͖Δͱ͍͏γες Ϝͷੑ࣭ › ։์ดͷݪଇ͕ϕʔεʢͲͪΒ͕ઌͩΖ͏͔ʁʣ ݪଇҧͷݟ͚ͭํ › ؆୯ͳ͜ͱ͕͘͠ͳ͍ͬͯͳ͍͔ › ྨࣅͷػೳͷ࣮͕Ε͍ͯͳ͍͔ › ݟੵΓ͕͍ͭେنʹͳ͍ͬͯͳ͍͔ › ίϛοτʹେنͳؚ͕ࠩ·Ε͍ͯͳ͍͔ 35 / 46
Slide 36
Slide 36 text
ୈ III ෦ େنͳมߋͷରԠ 16 ষ ґଘؔ ґଘؔ 3 छྨ͋Δ › ཧతґଘؔ › ཧతґଘؔ › ࣌ؒతґଘؔ ґଘؔΛՄࢹԽͤΑ › αʔυύʔςΟϥΠϒϥϦಉ࢜ͷґଘؔ › ΠϯϙʔτϞδϡʔϧؒͷґଘؔ › ؔͷݺͼग़͠ͷՄࢹԽ 36 / 46
Slide 37
Slide 37 text
ୈ III ෦ େنͳมߋͷରԠ 17 ষ ίϯϙʔβϏϦςΟ ίʔυΛϙϦγʔͱϝΧχζϜʹͤΑ ϙϦγʔ ϏδωεχʔζΛղܾ͢ΔͨΊͷͷΛ୲͏ίʔυ ϝΧχζϜ ϙϦγʔΛ࣮ݱ͢ΔΈΛఏڙ͢Δίʔυ 37 / 46
Slide 38
Slide 38 text
ୈ III ෦ େنͳมߋͷରԠ ྫɿ ϙϦγʔͱϝΧχζϜͷ def repeat(times: int = 1) -> collections.abc.Callable def _repeat(func: collections.abc.Callable): @functools.wrap(func) def _wrapper(*args, **kwargs): for _ in range(times): func(*args, **kwargs) return _wrapper return _repeat ϝΧχζϜʢؔΛ܁Γฦ͠ݺͼग़͢ʣͱϙϦγʔʢؔͷதʣΛσίϨʔλͰ ͢Δɻ 38 / 46
Slide 39
Slide 39 text
ୈ III ෦ େنͳมߋͷରԠ 18 ষͱ 19 ষ 15 ষʮ֦ுੑʯ ɺ16 ষʮґଘؔʯ ɺ17 ষʮίϯϙʔβϏϦςΟʯͷ۩ମྫͱͯ͠ಡ ͏ɻ ۩ମతͳઃܭʹ͍ͭͯΦϥΠϦʔ͔Β͍͍ຊ͕ͰΔΒ͍͠...ʁ 39 / 46
Slide 40
Slide 40 text
ୈ IV ෦ ηʔϑςΟωοτͷߏங 20 ষ ੩తղੳ ੩తղੳ ຊॻͰ Pylint ͕հ͞Ε͍ͯΔ͕ɺݸਓతʹ flake8 ͕Α͍ͱࢥͬ ͍ͯΔɻ ෳࡶνΣοΧ MeCabe ͷ॥తෳࡶɺۭനώϡʔϦεςΟΫε ηΩϡϦςΟ Bandit ੩తղੳ͚ͩʹߜ͍͚ͬͯͳ͍ ෳͷղੳπʔϧΛಋೖͯ͠ӴઢΛෳߏங͠Α͏ 40 / 46
Slide 41
Slide 41 text
ୈ IV ෦ ηʔϑςΟωοτͷߏங 21 ষ ςετઓུ ҎԼͷ 2 ΛಡΜͰ͍ΔਓʹͷͨΓͳ͍͔͠Εͳ͍ɻ › ςετۦಈ Pythonʢᠳӭࣾʣ › ୯ମςετͷߟ͑ํʗ͍ํʢϚΠφϏग़൛ʣ pytest Λ͏ͱࣗવʹ࣮ફͰ͖Δ͔͠Εͳ͍ 41 / 46
Slide 42
Slide 42 text
ୈ IV ෦ ηʔϑςΟωοτͷߏங 22 ষ ड͚ೖΕςετ Gherkin ݴޠΛհ͍ͯ͠Δ͕ɺݸਓతʹͲ͏ͩΖ͏ɺͱ͍͏ɻ ͋ΔϓϩάϥϚͷࢥ͍ग़ աڈɺࣄΛ࢝Ί͔ͨΓͷࠒɺ·ͱʹϓϩάϥϛϯά͕Ͱ͖ͳ͍ঢ়ଶͰ BDD Cucumber ΛؚΉ Ruby on Rails ͷνϡʔτϦΞϧΛಡΜͰɺBDD Cucumber ͕ۤखʹͳͬͨɻͦΕΛະͩʹҾ͖͍ͣͬͯΔͷ͔͠Εͳ͍ɻ 42 / 46
Slide 43
Slide 43 text
ୈ IV ෦ ηʔϑςΟωοτͷߏங 23 ষ ϓϩύςΟϕʔεςετ Hypothesis ʹΑΔϓϩύςΟϕʔεςετͷհ ϓϩύςΟϕʔεςετͱ ݻఆͨ͠ೖग़ྗʹجͮ͘ςετͰͳ͘ɺೖग़ྗ͕ຬ͖ͨ͢ੑ࣭Λهड़͢Δςετɻ ͦͷੑ࣭Λຬͨ͢Λπʔϧ͕ࣗಈੜͯ͠ςετέʔεΛੜ͢Δɻ 43 / 46
Slide 44
Slide 44 text
ୈ IV ෦ ηʔϑςΟωοτͷߏங 24 ষ ϛϡʔςʔγϣϯςετ mutmut ʹΑΔϛϡʔςʔγϣϯςετͷհ ϛϡʔςʔγϣϯςετͱ ςετࣗମΛςετ͢ΔςετɻιʔείʔυΛπʔϧͰॻ͖͑ͯطଘͷςετΛ Βͤͯɺςετ͕ޭͯ͠͠·ͬͨͷΛᖰΓͩ͢ɻ 44 / 46
Slide 45
Slide 45 text
·ͱΊ ʰϩόετ Pythonʱ͕ݴ͍͍ͨ͜ͱ › σʔλܕͱίϛϡχέʔγϣϯखஈͰ͋Δ › ͕ࣗίʔυͰදݱ͍ͨ͜͠ͱΛσʔλܕΛͬͯ໌֬ʹ͑Α͏ 45 / 46
Slide 46
Slide 46 text
·ͱΊ ͬͦ͘͞ߪೖ͠Α͏ › https://www.oreilly.co.jp/books/9784814400171/ › https://www.ohmsha.co.jp/book/9784814400171/ ΦϥΠϦʔֶशϓϥοτϑΥʔϜͱ › https://www.oreilly.co.jp/online-learning/ › 6 ສҎ্ͷॻ੶ʢຊޠॻ੶͋Δʂʣ › 3 ສ࣌ؒҎ্ͷಈը › ۀքΤΩεύʔτʹΑΔϥΠϒΠϕϯτ › ΠϯλϥΫςΟϒͳγφϦΦͱαϯυϘοΫεΛ࣮ͬͨફతͳֶश › ެࣜೝఆࢼݧରࡦࢿྉ › ʰϩόετ PythonʱΦϥΠϦʔֶशϓϥοτϑΥʔϜͰಡΈ์ʢ༧ఆʣ 46 / 46