mirror of
https://github.com/triqs/dft_tools
synced 2024-12-23 12:55:17 +01:00
11d394fd5b
* moved the plovasp C++ code to c++/triqs_dft_tools/converters/vasp * added global header triqs_dft_tools/triqs_dft_tools.hpp * python dir based on single cmakelist file * registered C++ tests for plovasp * corrected imports for py3 tests for plovasp * corrected block order in sigma_from_file and srvo3_Gloc * exchanged ref files for sigma_from_file, srvo3_Gloc, SrVO3.ref.h5 * moved vasp converter bash scripts from dir shells to bin dir
28 lines
732 B
Python
28 lines
732 B
Python
r"""
|
|
Module defining a custom TestCase with extra functionality.
|
|
"""
|
|
|
|
import unittest
|
|
import numpy as np
|
|
|
|
class ArrayTestCase(unittest.TestCase):
|
|
"""
|
|
Custom TestCase class supporting array equality.
|
|
"""
|
|
def __init__(self, *args, **kwargs):
|
|
"""
|
|
Initializes a custom equality function for comparing numpy arrays.
|
|
"""
|
|
super(ArrayTestCase, self).__init__(*args, **kwargs)
|
|
self.addTypeEqualityFunc(np.ndarray, self.is_arrays_equal)
|
|
|
|
def is_arrays_equal(self, arr1, arr2, msg=None):
|
|
"""
|
|
Raises self.failureException is arrays arr1 and arr2
|
|
are not equal.
|
|
"""
|
|
if not np.allclose(arr1, arr2):
|
|
raise self.failureException(msg)
|
|
|
|
|