コード例 #1
0
 def test_ensure_on_supplied(self):
     data = '1'
     with ShouldRaise(TypeError('Cannot use if_supplied() as target')):
         store(data, if_supplied(target).x, 'y')
コード例 #2
0
 def test_if_supplied_required_falsy(self):
     data = Namespace(x=None)
     with ShouldRaise(NotPresent(None)):
         load(data, required(if_supplied(source.x)))
コード例 #3
0
 def test_if_supplied_str(self):
     compare(str(if_supplied(source.x)), expected='if_supplied(source.x)')
コード例 #4
0
 def test_if_supplied_falsy(self):
     data = Namespace(x=None)
     compare(load(data, if_supplied(source.x)), expected=NotPresent(None))
コード例 #5
0
 def test_if_supplied_string(self):
     data = Namespace(x='1')
     compare(load(data, if_supplied('x')), expected='1')
コード例 #6
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_ensure_on_supplied(self):
     data = '1'
     with ShouldRaise(TypeError('Cannot use if_supplied() as target')):
         store(data, if_supplied(target).x, 'y')
コード例 #7
0
 def test_if_supplied_truthy(self):
     data = Namespace(x='1')
     compare(load(data, if_supplied(source.x)), expected='1')
コード例 #8
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_if_supplied_str(self):
     compare(str(if_supplied(source.x)), expected='if_supplied(source.x)')
コード例 #9
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_if_supplied_required_falsy(self):
     data = Namespace(x=None)
     with ShouldRaise(NotPresent(None)):
         load(data, required(if_supplied(source.x)))
コード例 #10
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_if_supplied_string(self):
     data = Namespace(x='1')
     compare(load(data, if_supplied('x')), expected='1')
コード例 #11
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_if_supplied_falsy(self):
     data = Namespace(x=None)
     compare(load(data, if_supplied(source.x)), expected=NotPresent(None))
コード例 #12
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_if_supplied_truthy(self):
     data = Namespace(x='1')
     compare(load(data, if_supplied(source.x)), expected='1')