Ejemplo 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)
Ejemplo 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)
Ejemplo n.º 3
0
 def test_path_with_encoding(self):
     with NamedTemporaryFile() as source:
         source.write(b'{"x": "\xa3"}')
         source.flush()
         config = Config.from_path(source.name, 'json', encoding='latin-1')
     compare(config.x, expected=u'\xa3')
Ejemplo n.º 4
0
 def test_path_explicit_callable_parser(self):
     with NamedTemporaryFile() as source:
         source.write(b'{"x": 1}')
         source.flush()
         config = Config.from_path(source.name, python_literal)
     compare(config.x, expected=1)
Ejemplo n.º 5
0
 def test_path_explicit_string_parser(self):
     with NamedTemporaryFile() as source:
         source.write(b'{"x": 1}')
         source.flush()
         config = Config.from_path(source.name, 'json')
     compare(config.x, expected=1)
Ejemplo n.º 6
0
 def test_path_guess_parser(self):
     with NamedTemporaryFile(suffix='.json') as source:
         source.write(b'{"x": 1}')
         source.flush()
         config = Config.from_path(source.name)
     compare(config.x, expected=1)
Ejemplo n.º 7
0
 def test_path_with_encoding(self):
     with NamedTemporaryFile() as source:
         source.write(b'{"x": "\xa3"}')
         source.flush()
         config = Config.from_path(source.name, 'json', encoding='latin-1')
     compare(config.x, expected=u'\xa3')
Ejemplo n.º 8
0
 def test_path_explicit_callable_parser(self):
     with NamedTemporaryFile() as source:
         source.write(b'{"x": 1}')
         source.flush()
         config = Config.from_path(source.name, python_literal)
     compare(config.x, expected=1)
Ejemplo n.º 9
0
 def test_path_explicit_string_parser(self):
     with NamedTemporaryFile() as source:
         source.write(b'{"x": 1}')
         source.flush()
         config = Config.from_path(source.name, 'json')
     compare(config.x, expected=1)
Ejemplo n.º 10
0
 def test_path_guess_parser(self):
     with NamedTemporaryFile(suffix='.json') as source:
         source.write(b'{"x": 1}')
         source.flush()
         config = Config.from_path(source.name)
     compare(config.x, expected=1)