<commit_before>import unittest

import numpy as np

from vaspy.thermo import OsziCar


class TestOsziCar(unittest.TestCase):

    def setUp(self):
        #create an instance of OSZICAR file
        self.x = OsziCar('../testdata/OSZICAR')

    def test_attrs(self):
        "Make sure load() effects."
        self.assertTrue(hasattr(self.x, 'E0'))
        self.assertTrue(hasattr(self.x, 'dE'))
        self.assertTrue(hasattr(self.x, 'F'))
        self.assertTrue(hasattr(self.x, 'step'))
        self.assertTrue(hasattr(self.x, 'mag'))
        self.assertTrue(hasattr(self.x, 'content'))

        #should raise an exception for an AttributeError
        self.assertRaises(AttributeError)

    def test_esort(self):
        "Make sure the esort() effects"<commit_msg>check all vars in test_attrs()<commit_after># -*- coding:utf-8 -*-
'''
    OsziCar类单元测试.
'''
import unittest

import numpy as np

from vaspy.thermo import OsziCar


class TestOsziCar(unittest.TestCase):

    def setUp(self):
        #create an instance of OSZICAR file
        self.x = OsziCar('../testdata/OSZICAR')

    def test_attrs(self):
        "Make sure load() effects"
        for var in self.x.vars:
            self.assertTrue(hasattr(self.x, var))

        #should raise an exception for an AttributeError
        self.assertRaises(AttributeError)

    def test_esort(self):
        "Make sure the esort() effects"
{'fraction_non_alphanumeric': 0.1167621776504298, 'fraction_numerical': 0.0014326647564469914, 'mean_word_length': 2.8484848484848486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5362572', 'n_tokens_mistral': 450, 'n_tokens_neox': 448, 'n_words': 110}