Increase coverage moar

This commit is contained in:
Anthony Sottile 2014-04-13 15:28:48 -07:00
parent 0fec434380
commit 7d4787eced
4 changed files with 14 additions and 8 deletions

View file

@ -1,3 +1,6 @@
import jsonschema.exceptions
import pytest
from pre_commit.jsonschema_extensions import apply_defaults
from pre_commit.jsonschema_extensions import remove_defaults
@ -78,3 +81,9 @@ def test_remove_defaults_removes_default():
{'properties': {'foo': {'default': 'bar'}}},
)
assert ret == {}
@pytest.mark.parametrize('func', (apply_defaults, remove_defaults))
def test_still_validates_schema(func):
with pytest.raises(jsonschema.exceptions.ValidationError):
func({}, {'properties': {'foo': {}}, 'required': ['foo']})

View file

@ -21,7 +21,7 @@ def test_CalledProcessError_str():
@pytest.fixture
def popen_mock():
popen = mock.Mock(spec=subprocess.Popen)
popen.return_value.communicate.return_value = ('stdout', 'stderr')
popen.return_value.communicate.return_value = (b'stdout', b'stderr')
return popen