File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import unittest
22import odml
33import os
4+ import sys
45import odml .validation
56import odml .terminology
67from . import test_samplefile as samplefile
78
9+ try :
10+ from StringIO import StringIO
11+ except ImportError :
12+ from io import StringIO
13+
814validate = odml .validation .Validation
915
1016
@@ -176,6 +182,19 @@ def test_standalone_property(self):
176182 for err in validate (prop ).errors :
177183 assert not err .is_error
178184
185+ def test_section_init (self ):
186+ """
187+ Test validation errors printed to stdout on section init.
188+ """
189+ val_errs = StringIO ()
190+
191+ old_stdout = sys .stdout
192+ sys .stdout = val_errs
193+ odml .Section (name = "sec" , type = None )
194+ sys .stdout = old_stdout
195+
196+ assert "Section type undefined" in val_errs .getvalue ()
197+
179198 def test_prop_string_values (self ):
180199 """
181200 Test if property values set as dtype string but could be of different dtype
You can’t perform that action at this time.
0 commit comments