<commit_before>from __future__ import division, print_function

import os
import unittest
import collections
import numpy as np

from pymatgen.util.testing import PymatgenTest
from pymatgen.io.abinitio import GSR_Reader

import numpy.testing.utils as nptu

test_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..",
                        'test_files')

try:
    import netCDF4
except ImportError:
    netCDF4 = None


def filepath(basename):
    return os.path.join(test_dir, basename)


class GSR_Reader_TestCase(PymatgenTest):

    def setUp(self):
        formulas = ["Si2",]
        self.GSR_paths = d = {}
        for formula in formulas:
            d[formula] = filepath(formula + "_GSR.nc")

    @unittest.skipIf(netCDF4 is None, "Requires Netcdf4")
    def test_read_Si2(self):
        path = self.GSR_paths["Si2"]

        ref_int_values = {
            "space_group" : 227,
            "number_of_states" : np.reshape([15, 15], (1,2)),
        }
<commit_msg> Removed useless import in test_netcdf<commit_after>from __future__ import division, print_function

import os
import unittest
import collections
import numpy as np

from pymatgen.util.testing import PymatgenTest
from pymatgen.io.abinitio import GSR_Reader

test_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..",
                        'test_files')

try:
    import netCDF4
except ImportError:
    netCDF4 = None


def filepath(basename):
    return os.path.join(test_dir, basename)


class GSR_Reader_TestCase(PymatgenTest):

    def setUp(self):
        formulas = ["Si2",]
        self.GSR_paths = d = {}
        for formula in formulas:
            d[formula] = filepath(formula + "_GSR.nc")

    @unittest.skipIf(netCDF4 is None, "Requires Netcdf4")
    def test_read_Si2(self):
        path = self.GSR_paths["Si2"]

        ref_int_values = {
            "space_group" : 227,
            "number_of_states" : np.reshape([15, 15], (1,2)),
        }

{'fraction_non_alphanumeric': 0.11818644931227713, 'fraction_numerical': 0.0163015792154865, 'mean_word_length': 2.7842003853564545, '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': '4542683', 'n_tokens_mistral': 702, 'n_tokens_neox': 663, 'n_words': 147}