Esempio n. 1
0
 def test_stream_with_name_guess_parser(self):
     with NamedTemporaryFile(suffix='.json') as source:
         source.write(b'{"x": 1}')
         source.flush()
         source.seek(0)
         config = Config.from_stream(source)
     compare(config.x, expected=1)
Esempio n. 2
0
 def test_stream_with_name_guess_parser(self):
     with NamedTemporaryFile(suffix='.json') as source:
         source.write(b'{"x": 1}')
         source.flush()
         source.seek(0)
         config = Config.from_stream(source)
     compare(config.x, expected=1)
Esempio n. 3
0
 def test_stream_callable_parser(self):
     source = StringIO(u'{"x": 1}')
     config = Config.from_stream(source, python_literal)
     compare(config.x, expected=1)
Esempio n. 4
0
 def test_stream_string_parser(self):
     source = StringIO(u'{"x": 1}')
     config = Config.from_stream(source, 'json')
     compare(config.x, expected=1)
Esempio n. 5
0
 def test_stream_no_name_no_parser(self):
     source = StringIO(u'{"x": 1}')
     with ShouldRaise(ParseError("No parser found for None")):
         Config.from_stream(source)
Esempio n. 6
0
 def test_stream(self):
     with StringIO(u'{"x": 1}') as source:
         config = Config.from_stream(source)
     compare(config.x, expected=1)
Esempio n. 7
0
 def test_stream_callable_parser(self):
     source = StringIO(u'{"x": 1}')
     config = Config.from_stream(source, python_literal)
     compare(config.x, expected=1)
Esempio n. 8
0
 def test_stream_string_parser(self):
     source = StringIO(u'{"x": 1}')
     config = Config.from_stream(source, 'json')
     compare(config.x, expected=1)
Esempio n. 9
0
 def test_stream_no_name_no_parser(self):
     source = StringIO(u'{"x": 1}')
     with ShouldRaise(ParseError("No parser found for None")):
         Config.from_stream(source)