Skip to content

Commit

Permalink
added more tests on unset values, bumped version and added new contri…
Browse files Browse the repository at this point in the history
…butor @okdtsk
  • Loading branch information
darthbear committed Apr 2, 2015
1 parent d3b657f commit fe98e3d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Version 0.2.3

* fixed bug when we insert None values that shouldn't raise an exception when getting them. PR [#7]

## Version 0.2.2

* simplified code (ConfigTree extends OrderedDict) and other features. PR [#6]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,4 @@ Java properties mapping | :x:
- Aleksey Ostapenko ([@kbabka](https://github.com/kbakba))
- Martynas Mickevičius ([@2m](https://github.com/2m))
- Joe Halliwell ([@joehalliwell](https://github.com/joehalliwell))
- Tasuku Okuda ([@okdtsk](https://github.com/okdtsk))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name='pyhocon',
version='0.2.2',
version='0.2.3',
description='HOCON parser for Python',
long_description='pyhocon is a HOCON parser for Python. Additionally we provide a tool (pyhocon) to convert any HOCON content into json, yaml and properties format.',
keywords='hocon parser',
Expand Down
20 changes: 20 additions & 0 deletions tests/test_config_parser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import pytest
from pyhocon import ConfigFactory
from pyhocon.exceptions import ConfigMissingException


class TestConfigParser(object):
Expand Down Expand Up @@ -117,6 +119,24 @@ def test_parse_with_comments(self):
assert config.get_string('a.b') == 'test'
assert config.get('t') == [1, 2, 3]

def test_missing_config(self):
config = ConfigFactory.parse_string(
"""
a = 5
"""
)
# b is not set so show raise an exception
with pytest.raises(ConfigMissingException):
assert config.get('b')

def test_parse_null(self):
config = ConfigFactory.parse_string(
"""
a = null
"""
)
assert config.get('a') is None

def test_parse_empty(self):
config = ConfigFactory.parse_string(
"""
Expand Down

0 comments on commit fe98e3d

Please sign in to comment.