# Path: hftools/testing/common.py
# class TestCase(unittest.TestCase):
#     def assertAllclose(self, a, b, rtol=1e-05, atol=1e-08, msg=None):
#         a = np.asanyarray(a)
#         b = np.asanyarray(b)
#         if msg is None:
#             msg = "a (%s) not close to b (%s)" % (a, b)
#         self.assertTrue(np.allclose(a, b, rtol, atol), msg)
# 
#     def assertIsNotInstance(self, obj, cls):
#         self.assertFalse(isinstance(obj, cls))
# 
#     def assertIsInstance(self, obj, cls, msg=None):
#         """Same as self.assertTrue(isinstance(obj, cls)), with a nicer
#         default message."""
#         if not isinstance(obj, cls):
#             arg = (unittest.case.safe_repr(obj), cls)
#             standardMsg = '%s is not an instance of %r' % arg
#             self.fail(self._formatMessage(msg, standardMsg))
# 
#     def assertHFToolsWarning(self, funk, *k, **kw):
#         warnings.resetwarnings()
#         warnings.simplefilter("error", HFToolsWarning)
#         self.assertRaises(HFToolsWarning, funk, *k, **kw)
#         warnings.simplefilter("ignore", HFToolsWarning)
# 
#     def assertHFToolsDeprecationWarning(self, funk, *k, **kw):
#         warnings.resetwarnings()
#         warnings.simplefilter("error", HFToolsDeprecationWarning)
#         self.assertRaises(HFToolsDeprecationWarning, funk, *k, **kw)
#         warnings.simplefilter("ignore", HFToolsDeprecationWarning)


import numpy as np
import os, pdb
from hftools.testing import TestCase
class Test_1(TestCase):
    readfun = None
    basepath = None
    dirname = None
    extension = None
    filename = "test1"
    readpars = {"verbose":False}
    def setUp(self):
        self.facit_f = np.array([0, 1, 2, 3]) * 1e9
        self.facit_s = (np.array([[[1, 2], [3, 4]]]) *
                        np.array([1, 1j, -1, -1j])[:, np.newaxis, np.newaxis])
        self.comments = []
        self.read_data()

    def read_data(self):
        fname = self.basepath / u"testdata" / self.dirname / self.filename + self.extension
        self.block = self.readfun[0](fname, **self.readpars)

    def test_comments(self):
        self.assertEqual(self.block.comments.fullcomments, self.comments)

    def test_freq(self):
        self.assertAllclose(self.facit_f, self.block["freq"])

    def test_data(self):
        self.assertAllclose(self.facit_s, self.block["S"])

class Test_2(Test_1):
    filename = "test2"


# Path: hftools/testing/common.py
# class TestCase(unittest.TestCase):
#     def assertAllclose(self, a, b, rtol=1e-05, atol=1e-08, msg=None):
#         a = np.asanyarray(a)
#         b = np.asanyarray(b)
#         if msg is None:
#             msg = "a (%s) not close to b (%s)" % (a, b)
#         self.assertTrue(np.allclose(a, b, rtol, atol), msg)
# 
#     def assertIsNotInstance(self, obj, cls):
#         self.assertFalse(isinstance(obj, cls))
# 
#     def assertIsInstance(self, obj, cls, msg=None):
#         """Same as self.assertTrue(isinstance(obj, cls)), with a nicer
#         default message."""
#         if not isinstance(obj, cls):
#             arg = (unittest.case.safe_repr(obj), cls)
#             standardMsg = '%s is not an instance of %r' % arg
#             self.fail(self._formatMessage(msg, standardMsg))
# 
#     def assertHFToolsWarning(self, funk, *k, **kw):
#         warnings.resetwarnings()
#         warnings.simplefilter("error", HFToolsWarning)
#         self.assertRaises(HFToolsWarning, funk, *k, **kw)
#         warnings.simplefilter("ignore", HFToolsWarning)
# 
#     def assertHFToolsDeprecationWarning(self, funk, *k, **kw):
#         warnings.resetwarnings()
#         warnings.simplefilter("error", HFToolsDeprecationWarning)
#         self.assertRaises(HFToolsDeprecationWarning, funk, *k, **kw)
#         warnings.simplefilter("ignore", HFToolsDeprecationWarning)


# Path: hftools/file_formats/tests/base_test.py
import numpy as np
import os, pdb
from hftools.testing import TestCase

class Test_1(TestCase):
    readfun = None
    basepath = None
    dirname = None
    extension = None
    filename = "test1"
    readpars = {"verbose":False}
    def setUp(self):
        self.facit_f = np.array([0, 1, 2, 3]) * 1e9
        self.facit_s = (np.array([[[1, 2], [3, 4]]]) *
                        np.array([1, 1j, -1, -1j])[:, np.newaxis, np.newaxis])
        self.comments = []
        self.read_data()

    def read_data(self):
        fname = self.basepath / u"testdata" / self.dirname / self.filename + self.extension
        self.block = self.readfun[0](fname, **self.readpars)

    def test_comments(self):
        self.assertEqual(self.block.comments.fullcomments, self.comments)

    def test_freq(self):
        self.assertAllclose(self.facit_f, self.block["freq"])

    def test_data(self):
        self.assertAllclose(self.facit_s, self.block["S"])

class Test_2(Test_1):
    filename = "test2"


class Test_3(Test_1):