# 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)
# 
# def make_load_tests(module):
#     """Add doctests to tests for module
# 
#     usage::
#         load_tests = make_load_tests(module)
#     """
#     warnings.simplefilter("error", HFToolsWarning)
#     warnings.simplefilter("error", HFToolsDeprecationWarning)
# #    warnings.simplefilter("error", DeprecationWarning)
# 
#     def load_tests(loader, standard_tests, pattern):
#         suite = unittest.TestSuite()
#         suite.addTests(standard_tests)
#         DocTests = doctest.DocTestSuite(module)
#         suite.addTests(DocTests)
#         return suite
#     return load_tests
# 
# Path: hftools/testing/common.py
# def random_value_array(N, maxsize, minsize=1):
#     dims = random_dims(N, maxsize, minsize)
#     return random_value_array_from_dims(dims)
# 
# Path: hftools/utils.py
# def reset_hftools_warnings():
# def timestamp(highres=False):
# def warn(msg):
# def deprecate(msg):
#     def isnumber(x):
#     def isrealnumber(x):
#     def isnumber(x):
#     def isrealnumber(x):
# def is_numlike(a):
# def is_integer(a):
# def to_numeric(value, error=True):
# def stable_uniq(data):
# def uniq(data):
# def chop(x, rtol=1e-9, atol=1e-15):
# def make_dirs(*pathsegments):
# def split_num(string):
# def lex_order(lista):
# def glob(pat):
#     def beep(freq=None, duration=50):
#     def beep(freq=None, duration=50):
# def flatten(lista):


import os
import warnings
import numpy as np
import hftools.dataset.arrayobj as aobj
import hftools.dataset.dim as dim
import hftools.dataset as ds
from numpy import newaxis
from hftools.testing import TestCase, make_load_tests
from hftools.testing import random_value_array
from hftools.utils import reset_hftools_warnings, HFToolsDeprecationWarning
        w = aobj.expand_diagonals(self.b, (ds.DiagAxis("f", 3),))
        B = np.zeros((3, 3, 3))
        for i in range(3):
            for j in range(3):
                B[i, i, j] = (j + 1) * 10 ** i
        self.assertAllclose(w, B)
        dims = (ds.IndepAxis("f", 3), ds.DerivAxis("f", 3),
                ds.DiagAxis("p", 3), )
        self.assertEqual(w.dims, dims)

    def test_5(self):
        w = aobj.expand_diagonals(self.b, (ds.DiagAxis("p", 3),))
        B = np.zeros((3, 3, 3))
        for i in range(3):
            for j in range(3):
                B[i, j, j] = (j + 1) * 10 ** i
        self.assertAllclose(w, B)
        dims = (ds.DiagAxis("f", 3), ds.IndepAxis("p", 3),
                ds.DerivAxis("p", 3), )
        self.assertEqual(w.dims, dims)

    def test_error_1(self):
        self.assertRaises(Exception, aobj.expand_diagonals,
                          self.b, (ds.IndepAxis("p", 3),))

    def test_error_2(self):
        self.assertRaises(Exception, aobj.expand_diagonals,
                          self.a, (ds.DiagAxis("p", 3),))



# 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)
# 
# def make_load_tests(module):
#     """Add doctests to tests for module
# 
#     usage::
#         load_tests = make_load_tests(module)
#     """
#     warnings.simplefilter("error", HFToolsWarning)
#     warnings.simplefilter("error", HFToolsDeprecationWarning)
# #    warnings.simplefilter("error", DeprecationWarning)
# 
#     def load_tests(loader, standard_tests, pattern):
#         suite = unittest.TestSuite()
#         suite.addTests(standard_tests)
#         DocTests = doctest.DocTestSuite(module)
#         suite.addTests(DocTests)
#         return suite
#     return load_tests
# 
# Path: hftools/testing/common.py
# def random_value_array(N, maxsize, minsize=1):
#     dims = random_dims(N, maxsize, minsize)
#     return random_value_array_from_dims(dims)
# 
# Path: hftools/utils.py
# def reset_hftools_warnings():
# def timestamp(highres=False):
# def warn(msg):
# def deprecate(msg):
#     def isnumber(x):
#     def isrealnumber(x):
#     def isnumber(x):
#     def isrealnumber(x):
# def is_numlike(a):
# def is_integer(a):
# def to_numeric(value, error=True):
# def stable_uniq(data):
# def uniq(data):
# def chop(x, rtol=1e-9, atol=1e-15):
# def make_dirs(*pathsegments):
# def split_num(string):
# def lex_order(lista):
# def glob(pat):
#     def beep(freq=None, duration=50):
#     def beep(freq=None, duration=50):
# def flatten(lista):


# Path: hftools/dataset/tests/test_arrayobj.py
import os
import warnings
import numpy as np
import hftools.dataset.arrayobj as aobj
import hftools.dataset.dim as dim
import hftools.dataset as ds
from numpy import newaxis
from hftools.testing import TestCase, make_load_tests
from hftools.testing import random_value_array
from hftools.utils import reset_hftools_warnings, HFToolsDeprecationWarning

        w = aobj.expand_diagonals(self.b, (ds.DiagAxis("f", 3),))
        B = np.zeros((3, 3, 3))
        for i in range(3):
            for j in range(3):
                B[i, i, j] = (j + 1) * 10 ** i
        self.assertAllclose(w, B)
        dims = (ds.IndepAxis("f", 3), ds.DerivAxis("f", 3),
                ds.DiagAxis("p", 3), )
        self.assertEqual(w.dims, dims)

    def test_5(self):
        w = aobj.expand_diagonals(self.b, (ds.DiagAxis("p", 3),))
        B = np.zeros((3, 3, 3))
        for i in range(3):
            for j in range(3):
                B[i, j, j] = (j + 1) * 10 ** i
        self.assertAllclose(w, B)
        dims = (ds.DiagAxis("f", 3), ds.IndepAxis("p", 3),
                ds.DerivAxis("p", 3), )
        self.assertEqual(w.dims, dims)

    def test_error_1(self):
        self.assertRaises(Exception, aobj.expand_diagonals,
                          self.b, (ds.IndepAxis("p", 3),))

    def test_error_2(self):
        self.assertRaises(Exception, aobj.expand_diagonals,
                          self.a, (ds.DiagAxis("p", 3),))



class Test_make_same_dims(TestCase):