コード例 #1
0
 def test_convert(self):
     data = Namespace(x='1')
     compare(load(data, convert(source.x, int)), expected=1)
コード例 #2
0
 def test_string_item(self):
     data = {'foo': 'bar'}
     compare(load(data, 'foo'), expected='bar')
コード例 #3
0
 def test_string_dotted(self):
     data = {'foo': Namespace(x=1)}
     compare(load(data, 'foo.x'), expected=1)
コード例 #4
0
 def test_getitem_nested_not_present(self):
     data = {}
     with ShouldRaise(NotPresent('foo')):
         load(data, required(source['foo']['bar']))
コード例 #5
0
 def test_index_not_present_okay(self):
     data = ['a']
     compare(load(data, source[1]), expected=NotPresent(1))
コード例 #6
0
 def test_if_supplied_truthy(self):
     data = Namespace(x='1')
     compare(load(data, if_supplied(source.x)), expected='1')
コード例 #7
0
 def test_getitem(self):
     data = {'foo': 'bar'}
     compare(load(data, source['foo']), expected='bar')
コード例 #8
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_getitem(self):
     data = {'foo': 'bar'}
     compare(load(data, source['foo']), expected='bar')
コード例 #9
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_if_supplied_string(self):
     data = Namespace(x='1')
     compare(load(data, if_supplied('x')), expected='1')
コード例 #10
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')
コード例 #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_merge(self):
     with ShouldRaise(TypeError('Cannot use merge() in source')):
         load(None, source.merge())
コード例 #13
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_append(self):
     with ShouldRaise(TypeError('Cannot use append() in source')):
         load(None, source.append())
コード例 #14
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_insert(self):
     with ShouldRaise(TypeError('Cannot use insert() in source')):
         load(None, source.insert(0))
コード例 #15
0
 def test_convert_not_present(self):
     data = {}
     compare(load(data, convert('x', int)), expected=NotPresent('x'))
コード例 #16
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)))
コード例 #17
0
 def test_append(self):
     with ShouldRaise(TypeError('Cannot use append() in source')):
         load(None, source.append())
コード例 #18
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_index(self):
     data = ['a', 'b']
     compare(load(data, source[1]), expected='b')
コード例 #19
0
 def test_if_supplied_string(self):
     data = Namespace(x='1')
     compare(load(data, if_supplied('x')), expected='1')
コード例 #20
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_attr(self):
     data = Namespace(x=1)
     compare(load(data, source.x), expected=1)
コード例 #21
0
 def test_attr(self):
     data = Namespace(x=1)
     compare(load(data, source.x), expected=1)
コード例 #22
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_required_and_present(self):
     data = ['a', 'b']
     compare(load(data, required(source[1])), expected='b')
コード例 #23
0
 def test_attr_nested_not_present(self):
     data = Namespace()
     with ShouldRaise(NotPresent('x')):
        load(data, required(source.x.y))
コード例 #24
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_getitem_nested_not_present(self):
     data = {}
     with ShouldRaise(NotPresent('foo')):
         load(data, required(source['foo']['bar']))
コード例 #25
0
 def test_nested(self):
     data = {'foo': ['a', 'b', Namespace(x=1)]}
     compare(load(data, source['foo'][2].x), expected=1)
コード例 #26
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_index_not_present(self):
     data = ['a']
     with ShouldRaise(NotPresent(1)):
         load(data, required(source[1]))
コード例 #27
0
 def test_string_item_not_present(self):
     data = {}
     compare(load(data, 'foo'), expected=NotPresent('foo'))
コード例 #28
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_attr_nested_not_present(self):
     data = Namespace()
     with ShouldRaise(NotPresent('x')):
         load(data, required(source.x.y))
コード例 #29
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_convert_not_present(self):
     data = {}
     compare(load(data, convert('x', int)), expected=NotPresent('x'))
コード例 #30
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_getitem_not_present_okay(self):
     data = {}
     compare(load(data, source['foo']), expected=NotPresent('foo'))
コード例 #31
0
 def test_convert_string(self):
     data = Namespace(x='1')
     compare(load(data, convert('x', int)), expected=1)
コード例 #32
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_index_not_present_okay(self):
     data = ['a']
     compare(load(data, source[1]), expected=NotPresent(1))
コード例 #33
0
 def test_insert(self):
     with ShouldRaise(TypeError('Cannot use insert() in source')):
         load(None, source.insert(0))
コード例 #34
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_attr_not_present_okay(self):
     data = Namespace()
     compare(load(data, source.x), expected=NotPresent('x'))
コード例 #35
0
 def test_merge(self):
     with ShouldRaise(TypeError('Cannot use merge() in source')):
         load(None, source.merge())
コード例 #36
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_nested(self):
     data = {'foo': ['a', 'b', Namespace(x=1)]}
     compare(load(data, source['foo'][2].x), expected=1)
コード例 #37
0
 def test_if_supplied_falsy(self):
     data = Namespace(x=None)
     compare(load(data, if_supplied(source.x)), expected=NotPresent(None))
コード例 #38
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_nested_missing_okay(self):
     data = {'foo': []}
     compare(load(data, source['foo'][2].x), expected=NotPresent(2))
コード例 #39
0
 def test_if_supplied_required_falsy(self):
     data = Namespace(x=None)
     with ShouldRaise(NotPresent(None)):
         load(data, required(if_supplied(source.x)))
コード例 #40
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_string_item(self):
     data = {'foo': 'bar'}
     compare(load(data, 'foo'), expected='bar')
コード例 #41
0
 def test_index(self):
     data = ['a', 'b']
     compare(load(data, source[1]), expected='b')
コード例 #42
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_string_attr(self):
     data = Namespace(foo='bar')
     compare(load(data, 'foo'), expected='bar')
コード例 #43
0
 def test_required_and_present(self):
     data = ['a', 'b']
     compare(load(data, required(source[1])), expected='b')
コード例 #44
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_string_item_not_present(self):
     data = {}
     compare(load(data, 'foo'), expected=NotPresent('foo'))
コード例 #45
0
 def test_index_not_present(self):
     data = ['a']
     with ShouldRaise(NotPresent(1)):
         load(data, required(source[1]))
コード例 #46
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_string_attr_not_present(self):
     data = Namespace()
     compare(load(data, 'foo'), expected=NotPresent('foo'))
コード例 #47
0
 def test_getitem_not_present_okay(self):
     data = {}
     compare(load(data, source['foo']), expected=NotPresent('foo'))
コード例 #48
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_root(self):
     data = {'foo'}
     compare(load(data, source), expected=data)
コード例 #49
0
 def test_attr_not_present_okay(self):
     data = Namespace()
     compare(load(data, source.x), expected=NotPresent('x'))
コード例 #50
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_string_dotted(self):
     data = {'foo': Namespace(x=1)}
     compare(load(data, 'foo.x'), expected=1)
コード例 #51
0
 def test_nested_missing_okay(self):
     data = {'foo': []}
     compare(load(data, source['foo'][2].x),
             expected=NotPresent(2))
コード例 #52
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_string_item_not_present_required(self):
     data = {}
     with ShouldRaise(NotPresent('foo')):
         load(data, required('foo'))
コード例 #53
0
 def test_string_attr(self):
     data = Namespace(foo='bar')
     compare(load(data, 'foo'), expected='bar')
コード例 #54
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_convert(self):
     data = Namespace(x='1')
     compare(load(data, convert(source.x, int)), expected=1)
コード例 #55
0
 def test_string_attr_not_present(self):
     data = Namespace()
     compare(load(data, 'foo'), expected=NotPresent('foo'))
コード例 #56
0
 def test_root(self):
     data = {'foo'}
     compare(load(data, source), expected=data)
コード例 #57
0
 def test_string_item_not_present_required(self):
     data = {}
     with ShouldRaise(NotPresent('foo')):
         load(data, required('foo'))
コード例 #58
0
ファイル: test_mapping.py プロジェクト: igivon/configurator
 def test_convert_string(self):
     data = Namespace(x='1')
     compare(load(data, convert('x', int)), expected=1)