Increase code coverage slightly
An Environment will always have a CompositeDataSource, so there was no way those exceptions could get raised.stix2.0
parent
3abfe7868a
commit
dd8f0f5c72
|
@ -114,16 +114,10 @@ class Environment(DataStoreMixin):
|
||||||
create.__doc__ = ObjectFactory.create.__doc__
|
create.__doc__ = ObjectFactory.create.__doc__
|
||||||
|
|
||||||
def add_filters(self, *args, **kwargs):
|
def add_filters(self, *args, **kwargs):
|
||||||
try:
|
return self.source.filters.update(*args, **kwargs)
|
||||||
return self.source.filters.update(*args, **kwargs)
|
|
||||||
except AttributeError:
|
|
||||||
raise AttributeError('Environment has no data source')
|
|
||||||
|
|
||||||
def add_filter(self, *args, **kwargs):
|
def add_filter(self, *args, **kwargs):
|
||||||
try:
|
return self.source.filters.add(*args, **kwargs)
|
||||||
return self.source.filters.add(*args, **kwargs)
|
|
||||||
except AttributeError:
|
|
||||||
raise AttributeError('Environment has no data source')
|
|
||||||
|
|
||||||
def parse(self, *args, **kwargs):
|
def parse(self, *args, **kwargs):
|
||||||
return _parse(*args, **kwargs)
|
return _parse(*args, **kwargs)
|
||||||
|
|
|
@ -16,6 +16,8 @@ def test_property():
|
||||||
p = Property()
|
p = Property()
|
||||||
|
|
||||||
assert p.required is False
|
assert p.required is False
|
||||||
|
assert p.clean('foo') == 'foo'
|
||||||
|
assert p.clean(3) == 3
|
||||||
|
|
||||||
|
|
||||||
def test_basic_clean():
|
def test_basic_clean():
|
||||||
|
|
Loading…
Reference in New Issue