File: test_common.py

package info (click to toggle)
hdmf 3.14.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,372 kB
  • sloc: python: 34,738; makefile: 303; sh: 35
file content (28 lines) | stat: -rw-r--r-- 1,108 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from hdmf import Data, Container
from hdmf.common import get_type_map, load_type_config, unload_type_config
from hdmf.testing import TestCase


class TestCommonTypeMap(TestCase):

    def test_base_types(self):
        tm = get_type_map()
        cls = tm.get_dt_container_cls('Container', 'hdmf-common')
        self.assertIs(cls, Container)
        cls = tm.get_dt_container_cls('Data', 'hdmf-common')
        self.assertIs(cls, Data)

    def test_copy_ts_config(self):
        path = 'tests/unit/hdmf_config.yaml'
        load_type_config(config_path=path)
        tm = get_type_map()
        config = {'namespaces': {'hdmf-common': {'version': '3.12.2',
                  'data_types': {'VectorData':
                 {'description': {'termset': 'example_test_term_set.yaml'}},
                  'VectorIndex': {'data': '...'}}}, 'foo_namespace':
                 {'version': '...', 'data_types':
                 {'ExtensionContainer': {'description': None}}}}}

        self.assertEqual(tm.type_config.config, config)
        self.assertEqual(tm.type_config.path, [path])
        unload_type_config()