<commit_before>#
# -*- coding: utf-8 -*-
#
# This file is part of reclass (http://github.com/madduck/reclass)
#
# Copyright © 2007–13 <NAME> <<EMAIL>>
# Released under the terms of the Artistic Licence 2.0
#
import storage.yaml_fs.yamlfile as yamlfile
import os, sys

TESTFILE = os.path.join(sys.path[0], 'nodes', 'blue.yml')
EMPTYFILE = os.path.join(sys.path[0], 'nodes', 'empty.yml')

class TestYamlFile:

    def setUp(self):
        self._file = yamlfile.YamlFile(TESTFILE)

    def test_path_property(self):
        assert self._file.path == TESTFILE

    def test_data(self):
        e = self._file.entity
        c = e.classes
        assert len(c) == 4
        assert hasattr(c, 'merge')
        p = e.parameters
        assert len(p) == 2
        assert 'motd' in p
        assert 'colour' in p
        assert hasattr(p, 'merge')
        a = e.applications
        assert len(a) == 1
        assert 'blues' in a
        assert hasattr(a, 'merge')

    def test_empty_file(self):
        e = yamlfile.YamlFile(EMPTYFILE).entity
        assert len(e.classes) == 0
        assert len(e.parameters) == 0
        assert len(e.applications) == 0<commit_msg>test types of Entity attributes<commit_after>#
# -*- coding: utf-8 -*-
#
# This file is part of reclass (http://github.com/madduck/reclass)
#
# Copyright © 2007–13 <NAME> <<EMAIL>>
# Released under the terms of the Artistic Licence 2.0
#
import storage.yaml_fs.yamlfile as yamlfile
import os, sys
from datatypes import Entity, Classes, Parameters, Applications

TESTFILE = os.path.join(sys.path[0], 'nodes', 'blue.yml')
EMPTYFILE = os.path.join(sys.path[0], 'nodes', 'empty.yml')

class TestYamlFile:

    def setUp(self):
        self._file = yamlfile.YamlFile(TESTFILE)

    def test_path_property(self):
        assert self._file.path == TESTFILE

    def test_data(self):
        e = self._file.entity
        c = e.classes
        assert len(c) == 4
        assert hasattr(c, 'merge')
        p = e.parameters
        assert len(p) == 2
        assert 'motd' in p
        assert 'colour' in p
        assert hasattr(p, 'merge')
        a = e.applications
        assert len(a) == 1
        assert 'blues' in a
        assert hasattr(a, 'merge')

    def test_empty_file(self):
        e = yamlfile.YamlFile(EMPTYFILE).entity
        assert isinstance(e, Entity)
        assert isinstance(e.classes, Classes)
        assert len(e.classes) == 0
        assert isinstance(e.parameters, Parameters)
        assert len(e.parameters) == 0
        assert isinstance(e.applications, Applications)
        assert len(e.applications) == 0
{'fraction_non_alphanumeric': 0.12495179328962591, 'fraction_numerical': 0.013112225221750868, 'mean_word_length': 2.5582990397805214, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '4425962', 'n_tokens_mistral': 877, 'n_tokens_neox': 833, 'n_words': 228}