Exemplo n.º 1
0
 def test_from_dict(self):
     """ test Python objects specified in `content`"""
     schema = {
         'options': {
             'required': True,
         },
         'content': {
             'foo': str,
         },
     }
     schema, options = from_dict(schema)
     schema = voluptuous.Schema(schema, **options)
     with self.assertRaises(Exception):
         schema({})
     with self.assertRaises(Exception):
         schema({'foo': 42})
     self.assertEqual(schema({'foo': 'bar'}), {'foo': 'bar'})
Exemplo n.º 2
0
 def _schema_from_dicts(self, core_conf, crawler_conf):
     schema, options = from_dict(
         merge_dicts(copy.deepcopy(core_conf), copy.deepcopy(crawler_conf)))
     return voluptuous.Schema(schema, **options)
Exemplo n.º 3
0
 def _schema_from_dicts(self, core_conf, crawler_conf):
     schema, options = from_dict(merge_dicts(copy.deepcopy(core_conf), copy.deepcopy(crawler_conf)))
     return voluptuous.Schema(schema, **options)
Exemplo n.º 4
0
 def get_yamlious(self, test):
     f = osp.splitext(__file__)[0] + '.yaml'
     with open(f) as istr:
         content = yaml.load(istr, Loader=Loader)
     return yamlious.from_dict(content[test])
Exemplo n.º 5
0
 def get_yamlious(self, test):
     f = osp.splitext(__file__)[0] + '.yaml'
     with open(f) as istr:
         content = yaml.load(istr, Loader=Loader)
     return yamlious.from_dict(content[test])