Skip to content

Commit

Permalink
#5 くら寿司URL・レイアウト変更
Browse files Browse the repository at this point in the history
  • Loading branch information
t3yamoto committed Aug 22, 2020
1 parent a282f4b commit cd99da4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 11 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

`sushi-allergy-parser` is a parser for allergy infomation document of japanese conveyor-belt sushi chain. Currently, the following documents are supported.

* スシロー (http://www3.akindo-sushiro.co.jp/pdf/menu/allergy.pdf)
* くら寿司 (http://www.kura-corpo.co.jp/common/pdf/kura_allergen.pdf)

- スシロー (http://www3.akindo-sushiro.co.jp/pdf/menu/allergy.pdf)
- くら寿司 (https://www.kurasushi.co.jp/common/pdf/kura_allergen.pdf)

## Requirements

Expand Down
10 changes: 5 additions & 5 deletions src/sushi_allergy_parser/kura.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from .base import AllergenState, BaseParser, Allergen
from .util import removeNewLine

REMOTE_URL = "http://www.kura-corpo.co.jp/common/pdf/kura_allergen.pdf"
REMOTE_URL = "https://www.kurasushi.co.jp/common/pdf/kura_allergen.pdf"
BASE_LAYOUT = [
("卵", Allergen.EGG.value, True), # header, key, required
("小麦", Allergen.WHEAT.value, True),
("乳・乳製品", Allergen.MILK.value, True),
("乳成分", Allergen.MILK.value, True),
("落花生ピーナッツ", Allergen.PEANUT.value, True),
("ソバ", Allergen.BUCKWHEAT.value, True),
("えび", Allergen.SHRIMP.value, True),
Expand All @@ -33,9 +33,9 @@
("山芋", Allergen.YAM_OR_SWEET_POTATO.value, True),
("モモ", Allergen.PEACH.value, True),
("ごま", Allergen.SESAME.value, True),
("あわび", Allergen.ABALONE.value, True),
# ("あわび", Allergen.ABALONE.value, True),
("カシューナッツ", Allergen.CASHEW_NUT.value, True),
("松茸", Allergen.MATSUTAKE_MUSHROOM.value, True),
# ("松茸", Allergen.MATSUTAKE_MUSHROOM.value, True),
]
PAGE1_LAYOUT = [
("品名", "name", True),
Expand All @@ -46,7 +46,7 @@
PAGE2_LAYOUT = PAGE1_LAYOUT
PAGE3_LAYOUT = [
("品名", "name", True),
("一(皿kカ・cロ一aリlー杯当)り", "calory", False),
("一(皿kカ・cロ一aリー杯l当)り", "calory", False),
("該当なし", "none", False),
*BASE_LAYOUT,
]
Expand Down
37 changes: 34 additions & 3 deletions tests/test_sushi_allergy_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,53 @@
"matsutakeMushroom",
]

EXPECTED_COLUMNS_KURA = [
"name",
"category",
"egg",
"wheat",
"milk",
"peanut",
"buckwheat",
"shrimp",
"crab",
"squid",
"salmonRoe",
"salmon",
"mackerel",
"beef",
"chicken",
"pork",
"soybean",
"orange",
"apple",
"gelatin",
"walnut",
"banana",
"kiwi",
"yamOrSweetPotato",
"peach",
"sesame",
"cashewNut",
]


def test_version():
assert __version__ == "0.1.3"


def test_sushiro():
df = KuraAllergyParser().parse()
df = SushiroAllergyParser().parse()
assert isinstance(df, pd.DataFrame)

for column in EXPECTED_COLUMNS:
assert isinstance(df[column], pd.Series)


def test_kura():
df = SushiroAllergyParser().parse()

df = KuraAllergyParser().parse()
assert isinstance(df, pd.DataFrame)

for column in EXPECTED_COLUMNS:
for column in EXPECTED_COLUMNS_KURA:
assert isinstance(df[column], pd.Series)

0 comments on commit cd99da4

Please sign in to comment.