| 1 |
import json |
| 2 |
|
| 3 |
from hdmf.spec import RefSpec |
| 4 |
from hdmf.testing import TestCase |
| 5 |
|
| 6 |
|
| 7 |
class RefSpecTests(TestCase): |
| 8 |
|
| 9 |
def test_constructor(self): |
| 10 |
spec = RefSpec('TimeSeries', 'object') |
| 11 |
self.assertEqual(spec.target_type, 'TimeSeries') |
| 12 |
self.assertEqual(spec.reftype, 'object') |
| 13 |
json.dumps(spec) # to ensure there are no circular links |
| 14 |
|
| 15 |
def test_wrong_reference_type(self): |
| 16 |
with self.assertRaises(ValueError): |
| 17 |
RefSpec('TimeSeries', 'unknownreftype') |
| 18 |
|
| 19 |
def test_isregion(self): |
| 20 |
spec = RefSpec('TimeSeries', 'object') |
| 21 |
self.assertFalse(spec.is_region()) |
| 22 |
spec = RefSpec('Data', 'region') |
| 23 |
self.assertTrue(spec.is_region()) |