<filename>tests/test_yaml_parser.py<gh_stars>0
"""
module to test yam_parser
"""
import os
from unittest import TestCase
import yaml

from src.yaml_parser.yaml_parser import get_yaml  # pylint: disable=import-error


class Test(TestCase):
    """
    class to test the yaml_parser functions
    """

    def setUp(self) -> None:
        data = {'name': '<NAME>', 'race': 'Human', 'traits': ['ONE_HAND', 'ONE_EYE']}
        with open('tests.yaml', 'w') as stream:
            yaml.dump(data, stream)

    def test_get_yaml(self):
        """
        function to test get_yaml
        """
        yaml_parsed = get_yaml("tests.yaml")
        data = {'name': '<NAME>', 'race': 'Human', 'traits': ['ONE_HAND', 'ONE_EYE']}
        self.assertEqual(data, yaml_parsed)

    def tearDown(self) -> None:
        os.remove("tests.yaml")
