# Path: hftools/dataset/comments.py
# class Comments(object):
#     comment_reg = re.compile(r"([^:]+)[ \t]*[:][ \t]*(.*)")
#     spacing_reg = re.compile(r"[ \t]+")
#     width = 76
# 
#     def __init__(self, fullcomments=None, **kw):
#         self.fullcomments = []
#         self.property = {}
#         self.property.update(kw)
#         if fullcomments is not None:
#             self.add_from_comments(fullcomments)
# 
#     def add_from_comment(self, comment):
#         comment = comment.lstrip("!").strip()
#         if comment:
#             for key, v in process_comment(comment).items():
#                 self.property[key] = v
#             self.fullcomments.append(comment)
# 
#     def add_from_comments(self, comments):
#         for comment in comments:
#             self.add_from_comment(comment)
# 
#     def extend(self, comment):
#         self.fullcomments.extend(comment.fullcomments)
#         for k, v in comment.property.items():
#             self.property[k] = v
# 
#     def copy(self):
#         out = Comments()
#         out.fullcomments = self.fullcomments[:]
#         out.property = self.property.copy()
#         return out
# 
#     def table(self):
#         if not self.property:
#             return []
#         keycolwid = max([len(x) for x in self.property.keys()])
#         valuecolwid = self.width - keycolwid
#         keyfmt = "%%-%ds" % keycolwid
#         valuefmt = "%%-%ds" % (valuecolwid)
#         table = [(" Comments ".center(self.width + 1, "-"),),
#                  (keyfmt % ("Key".center(keycolwid, " ")),
#                   valuefmt % ("Value".center(valuecolwid, " "))),
#                  ("-" * keycolwid,
#                   "-" * valuecolwid)]
#         for key, value in sorted(self.property.items()):
#             if hasattr(value, "strip"):
#                 value = value.strip()[:valuecolwid]
#             table.append((keyfmt % key, valuefmt % (value)))
#             key = ""
#         return [" ".join(x) for x in table]
# 
#     def __repr__(self):
#         return "\n".join(self.table())
# 
# 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 os
import pdb
import numpy as np
import hftools.dataset.comments as comments
import hftools.dataset.arrayobj as aobj
from hftools.dataset.comments import Comments
from hftools.testing import TestCase
        c.extend(c2)
        self.assertEqual(c.fullcomments, ["a: 10", "apa:11"])

    def test_table1(self):
        c = Comments(["apa:10", "kul: kasdjlkj"])
        x = c.table()
        self.assertEqual(x, [' Comments '.center(77, "-"),
                             'Key                                   ' +
                             'Value                                  ',
                             '--- ' + '-' * 73,
                             'apa 10.0                              ' +
                             '                                       ',
                             'kul kasdjlkj                           ' +
                             '                                      '])

    def test_table2(self):
        c = Comments(["apa:10", "kul: kasdjlkjlo aloksd olakds okal " +
                      "sdlokasdolkaolsdola " +
                      "sdolasdlk oasdasiukweyrkh sdfsadf "])
        x = c.table()
        self.assertEqual(x, [' Comments '.center(77, "-"),
                             'Key                                   ' +
                             'Value                                  ',
                             '--- ' + '-' * 73,
                             'apa 10.0                              ' +
                             '                                       ',
                             'kul kasdjlkjlo aloksd olakds okal ' +
                             'sdlokasdolkaolsdola sdolasdlk oasdasiukweyr'])

    def test_table3(self):

# Path: hftools/dataset/comments.py
# class Comments(object):
#     comment_reg = re.compile(r"([^:]+)[ \t]*[:][ \t]*(.*)")
#     spacing_reg = re.compile(r"[ \t]+")
#     width = 76
# 
#     def __init__(self, fullcomments=None, **kw):
#         self.fullcomments = []
#         self.property = {}
#         self.property.update(kw)
#         if fullcomments is not None:
#             self.add_from_comments(fullcomments)
# 
#     def add_from_comment(self, comment):
#         comment = comment.lstrip("!").strip()
#         if comment:
#             for key, v in process_comment(comment).items():
#                 self.property[key] = v
#             self.fullcomments.append(comment)
# 
#     def add_from_comments(self, comments):
#         for comment in comments:
#             self.add_from_comment(comment)
# 
#     def extend(self, comment):
#         self.fullcomments.extend(comment.fullcomments)
#         for k, v in comment.property.items():
#             self.property[k] = v
# 
#     def copy(self):
#         out = Comments()
#         out.fullcomments = self.fullcomments[:]
#         out.property = self.property.copy()
#         return out
# 
#     def table(self):
#         if not self.property:
#             return []
#         keycolwid = max([len(x) for x in self.property.keys()])
#         valuecolwid = self.width - keycolwid
#         keyfmt = "%%-%ds" % keycolwid
#         valuefmt = "%%-%ds" % (valuecolwid)
#         table = [(" Comments ".center(self.width + 1, "-"),),
#                  (keyfmt % ("Key".center(keycolwid, " ")),
#                   valuefmt % ("Value".center(valuecolwid, " "))),
#                  ("-" * keycolwid,
#                   "-" * valuecolwid)]
#         for key, value in sorted(self.property.items()):
#             if hasattr(value, "strip"):
#                 value = value.strip()[:valuecolwid]
#             table.append((keyfmt % key, valuefmt % (value)))
#             key = ""
#         return [" ".join(x) for x in table]
# 
#     def __repr__(self):
#         return "\n".join(self.table())
# 
# 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/dataset/tests/test_comments.py
import os
import pdb
import numpy as np
import hftools.dataset.comments as comments
import hftools.dataset.arrayobj as aobj
from hftools.dataset.comments import Comments
from hftools.testing import TestCase

        c.extend(c2)
        self.assertEqual(c.fullcomments, ["a: 10", "apa:11"])

    def test_table1(self):
        c = Comments(["apa:10", "kul: kasdjlkj"])
        x = c.table()
        self.assertEqual(x, [' Comments '.center(77, "-"),
                             'Key                                   ' +
                             'Value                                  ',
                             '--- ' + '-' * 73,
                             'apa 10.0                              ' +
                             '                                       ',
                             'kul kasdjlkj                           ' +
                             '                                      '])

    def test_table2(self):
        c = Comments(["apa:10", "kul: kasdjlkjlo aloksd olakds okal " +
                      "sdlokasdolkaolsdola " +
                      "sdolasdlk oasdasiukweyrkh sdfsadf "])
        x = c.table()
        self.assertEqual(x, [' Comments '.center(77, "-"),
                             'Key                                   ' +
                             'Value                                  ',
                             '--- ' + '-' * 73,
                             'apa 10.0                              ' +
                             '                                       ',
                             'kul kasdjlkjlo aloksd olakds okal ' +
                             'sdlokasdolkaolsdola sdolasdlk oasdasiukweyr'])

    def test_table3(self):

        c = Comments()