コード例 #1
0
 def test_getattr_dynamic(self):
     schema = Schema(dynamic=True)
     config = schema()
     assert config.x is None
コード例 #2
0
ファイル: test_stubs.py プロジェクト: Burrch3s/cincoconfig
 def test_get_annotation_typestr_schema(self):
     schema = Schema()
     assert get_annotation_typestr(schema) == 'cincoconfig.config.Schema'
コード例 #3
0
 def test_getattr_error(self):
     schema = Schema()
     config = schema()
     with pytest.raises(AttributeError):
         x = config.x
コード例 #4
0
 def test_call(self):
     schema = Schema()
     cfg = schema()
     assert isinstance(cfg, Config)
     assert cfg._schema is schema
コード例 #5
0
 def test_getattr_new(self):
     schema = Schema()
     field = schema.field
     assert isinstance(field, Schema)
     assert field._key == 'field'
コード例 #6
0
    def test_getattr(self):
        schema = Schema()
        field = Field()
        schema.field = field

        assert schema.field is field
コード例 #7
0
 def test_getitem_keyerror_not_schema(self):
     schema = Schema()
     schema.x = Field()
     with pytest.raises(KeyError):
         y = schema['x.y']
コード例 #8
0
 def test_getitem_keyerror(self):
     schema = Schema()
     with pytest.raises(KeyError):
         x = schema['x']