<commit_before># -*- coding: utf-8 -*-
import os
from math import floor
from xml.etree.ElementTree import Element, SubElement

from pybeerxml.parser import Parser, Recipe
from pybeerxml.hop import Hop
from pybeerxml.utils import to_lower

RECIPE_PATH = os.path.join(os.path.dirname(__file__), "Simcoe IPA.xml")
RECIPE_PATH_2 = os.path.join(os.path.dirname(__file__), "Oatmeal Stout.xml")
RECIPE_PATH_3 = os.path.join(os.path.dirname(__file__), "CoffeeStout.xml")


class TestParser:
    def test_parse_recipe_1_from_file(self):

        recipe_parser = Parser()
        recipes = recipe_parser.parse(RECIPE_PATH)
        self.assert_simcoe_ipa_recipe(recipes)

    def test_parse_recipe_1_from_string(self):

        xml_data = open(RECIPE_PATH, "r").read()
        recipe_parser = Parser()
        recipes = recipe_parser.parse_from_string(xml_data)
        self.assert_simcoe_ipa_recipe(recipes)

    def assert_simcoe_ipa_recipe(self, recipes):<commit_msg>fix test<commit_after># -*- coding: utf-8 -*-
import os
from math import floor
from xml.etree.ElementTree import Element, SubElement

from pybeerxml.parser import Parser, Recipe
from pybeerxml.hop import Hop
from pybeerxml.equipment import Equipment
from pybeerxml.utils import to_lower

RECIPE_PATH = os.path.join(os.path.dirname(__file__), "Simcoe IPA.xml")
RECIPE_PATH_2 = os.path.join(os.path.dirname(__file__), "Oatmeal Stout.xml")
RECIPE_PATH_3 = os.path.join(os.path.dirname(__file__), "CoffeeStout.xml")


class TestParser:
    def test_parse_recipe_1_from_file(self):

        recipe_parser = Parser()
        recipes = recipe_parser.parse(RECIPE_PATH)
        self.assert_simcoe_ipa_recipe(recipes)

    def test_parse_recipe_1_from_string(self):

        xml_data = open(RECIPE_PATH, "r").read()
        recipe_parser = Parser()
        recipes = recipe_parser.parse_from_string(xml_data)
        self.assert_simcoe_ipa_recipe(recipes)

    def assert_simcoe_ipa_recipe(self, recipes):
{'fraction_non_alphanumeric': 0.10076726342710997, 'fraction_numerical': 0.005115089514066497, 'mean_word_length': 4.4789915966386555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 19}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1317100', 'n_tokens_mistral': 706, 'n_tokens_neox': 684, 'n_words': 124}