4 from yaml
.error
import YAMLError
5 from yaml
.reader
import Reader
6 from yaml
.scanner
import Scanner
8 class TestErrors(test_appliance
.TestAppliance
):
10 def _testErrors(self
, test_name
, invalid_filename
):
11 #self._load(invalid_filename)
12 self
.failUnlessRaises(YAMLError
, lambda: self
._load
(invalid_filename
))
14 def _testStringErrors(self
, test_name
, invalid_filename
):
15 #self._load_string(invalid_filename)
16 self
.failUnlessRaises(YAMLError
, lambda: self
._load
_string
(invalid_filename
))
18 def _load(self
, filename
):
19 reader
= Reader(file(filename
, 'rb'))
20 scanner
= Scanner(reader
)
23 def _load_string(self
, filename
):
24 reader
= Reader(file(filename
, 'rb').read())
25 scanner
= Scanner(reader
)
28 TestErrors
.add_tests('testErrors', '.error-message')
29 TestErrors
.add_tests('testStringErrors', '.error-message')