Exemplo n.º 1
0
 def test_type(self):
     spec  = {
         'uni.age': {
             '$type': 'int'
             }
         }
     assert uni.check(spec, self.checkable)
Exemplo n.º 2
0
 def test_exists(self):
     spec  = {
         'uni.age': {
             '$exists': True,
             }
         }
     assert uni.check(spec, self.checkable)
Exemplo n.º 3
0
 def test_type_false(self):
     spec  = {
         'uni.age': {
             '$type': 'unicode'
             }
         }
     assert not uni.check(spec, self.checkable)
Exemplo n.º 4
0
 def test_nin(self):
     spec  = {
         'species': {
             '$nin': ['cow', 'pig', 'bunny']
             }
         }
     assert uni.check(spec, self.checkable)
Exemplo n.º 5
0
 def test_exists_false(self):
     spec  = {
         'uni.cow': {
             '$exists': False,
             }
         }
     assert uni.check(spec, self.checkable)
Exemplo n.º 6
0
 def test_all(self):
     spec = {
         'species': {
             '$all': [1, 2, 3],
         }
     }
     assert uni.check(spec, self.checkable)
Exemplo n.º 7
0
 def test_exists(self):
     spec = {
         'uni.age': {
             '$exists': True,
         }
     }
     assert uni.check(spec, self.checkable)
Exemplo n.º 8
0
 def test_exists_false(self):
     spec = {
         'uni.cow': {
             '$exists': False,
         }
     }
     assert uni.check(spec, self.checkable)
Exemplo n.º 9
0
 def test_all_false(self):
     spec  = {
         'species': {
             '$all': ['cow', 2, 3],
             }
         }
     assert not uni.check(spec, self.checkable)
Exemplo n.º 10
0
 def test_all(self):
     spec  = {
         'species': {
             '$all': [1, 2, 3],
             }
         }
     assert uni.check(spec, self.checkable)
Exemplo n.º 11
0
 def test_nin_false(self):
     spec  = {
         'species': {
             '$nin': ['cow', 'pig', 't-rex']
             }
         }
     assert not uni.check(spec, self.checkable)
Exemplo n.º 12
0
 def test_in(self):
     spec  = {
         'species': {
             '$in': ['cow', 'pig', 't-rex']
             }
         }
     assert uni.check(spec, self.checkable)
Exemplo n.º 13
0
 def test_all_false(self):
     spec = {
         'species': {
             '$all': ['cow', 2, 3],
         }
     }
     assert not uni.check(spec, self.checkable)
Exemplo n.º 14
0
 def test_lte_false(self):
     spec  = {
         'uni': {
             'age': {
                 '$lt': 2
                 }
             }
         }
     assert not uni.check(spec, self.checkable)
Exemplo n.º 15
0
 def test_gt(self):
     spec  = {
         'uni': {
             'age': {
                 '$gt': 2
                 }
             }
         }
     assert uni.check(spec, self.checkable)
Exemplo n.º 16
0
 def test_gt_false(self):
     spec  = {
         'uni': {
             'age': {
                 '$gt': 4
                 }
             }
         }
     assert not uni.check(spec, self.checkable)
Exemplo n.º 17
0
 def test_lt(self):
     spec  = {
         'uni': {
             'age': {
                 '$lt': 4
                 }
             }
         }
     assert uni.check(spec, self.checkable)
Exemplo n.º 18
0
 def test_lte_eq(self):
     spec  = {
         'uni': {
             'age': {
                 '$lte': 3
                 }
             }
         }
     assert uni.check(spec, self.checkable)
Exemplo n.º 19
0
 def test_ne_false(self):
     spec  = {
         'uni': {
             'age': {
                 '$ne': 3
                 }
             }
         }
     assert not uni.check(spec, self.checkable)
Exemplo n.º 20
0
 def test_or(self):
     spec  = {
         '$or': [
             {'uni.age': {'$ne': 3}},
             {'species': {
                 '$in': ['cow', 'pig', 't-rex']}
                 },
             ]
         }
     assert uni.check(spec, self.checkable)
Exemplo n.º 21
0
 def test_or_false(self):
     spec  = {
         '$or': [
             {'uni.age': {'$ne': 3}},
             {'species': {
                 '$in': ['cow', 'pig', 'bunny']}
                 },
             ]
         }
     assert not uni.check(spec, self.checkable)
Exemplo n.º 22
0
 def test_and_false(self):
     spec  = {
         '$and': [
             {'uni.age': {'$ne': 3}},
             {'species': {
                 '$in': ['cow', 'pig']}
                 },
             {'info.unicorns_are_real': False},
             {'info.unicorns_that_exist': 'cowcorn'},
             ]
         }
     assert not uni.check(spec, self.checkable)
Exemplo n.º 23
0
 def test_and(self):
     spec  = {
         '$and': [
             {'uni.age': {'$ne': 4}},
             {'species': {
                 '$in': ['cow', 'pig', 't-rex']}
                 },
             {'info.unicorns_are_real': True},
             {'info.unicorns_that_exist': 'uni'},
             ]
         }
     assert uni.check(spec, self.checkable)
Exemplo n.º 24
0
 def test_or(self):
     spec = {
         '$or': [
             {
                 'uni.age': {
                     '$ne': 3
                 }
             },
             {
                 'species': {
                     '$in': ['cow', 'pig', 't-rex']
                 }
             },
         ]
     }
     assert uni.check(spec, self.checkable)
Exemplo n.º 25
0
 def test_or_false(self):
     spec = {
         '$or': [
             {
                 'uni.age': {
                     '$ne': 3
                 }
             },
             {
                 'species': {
                     '$in': ['cow', 'pig', 'bunny']
                 }
             },
         ]
     }
     assert not uni.check(spec, self.checkable)
Exemplo n.º 26
0
 def test_and_false(self):
     spec = {
         '$and': [
             {
                 'uni.age': {
                     '$ne': 3
                 }
             },
             {
                 'species': {
                     '$in': ['cow', 'pig']
                 }
             },
             {
                 'info.unicorns_are_real': False
             },
             {
                 'info.unicorns_that_exist': 'cowcorn'
             },
         ]
     }
     assert not uni.check(spec, self.checkable)
Exemplo n.º 27
0
 def test_and(self):
     spec = {
         '$and': [
             {
                 'uni.age': {
                     '$ne': 4
                 }
             },
             {
                 'species': {
                     '$in': ['cow', 'pig', 't-rex']
                 }
             },
             {
                 'info.unicorns_are_real': True
             },
             {
                 'info.unicorns_that_exist': 'uni'
             },
         ]
     }
     assert uni.check(spec, self.checkable)
Exemplo n.º 28
0
 def test_getattr_false(self):
     spec  = {'type.__name__': {'$ne': 'list'}}
     assert uni.check(spec, self.checkable)
Exemplo n.º 29
0
 def test_type(self):
     spec = {'uni.age': {'$type': 'int'}}
     assert uni.check(spec, self.checkable)
Exemplo n.º 30
0
 def test_type_false(self):
     spec = {'uni.age': {'$type': 'unicode'}}
     assert not uni.check(spec, self.checkable)
Exemplo n.º 31
0
 def test_nin_false(self):
     spec = {'species': {'$nin': ['cow', 'pig', 't-rex']}}
     assert not uni.check(spec, self.checkable)
Exemplo n.º 32
0
 def test_lt(self):
     spec = {'uni': {'age': {'$lt': 4}}}
     assert uni.check(spec, self.checkable)
Exemplo n.º 33
0
 def test_nin(self):
     spec = {'species': {'$nin': ['cow', 'pig', 'bunny']}}
     assert uni.check(spec, self.checkable)
Exemplo n.º 34
0
 def test_index_getattr(self):
     spec  = {'types.0.__name__': 'str'}
     assert uni.check(spec, self.checkable)
Exemplo n.º 35
0
 def test_index_getattr(self):
     spec = {'types.0.__name__': 'str'}
     assert uni.check(spec, self.checkable)
Exemplo n.º 36
0
 def test_index_getattr_false(self):
     spec = {'types.1.__name__': {'$ne': 'dict'}}
     assert uni.check(spec, self.checkable)
Exemplo n.º 37
0
 def test_gte_gt(self):
     spec = {'uni': {'age': {'$gte': 2}}}
     assert uni.check(spec, self.checkable)
Exemplo n.º 38
0
 def test_gt_false(self):
     spec = {'uni': {'age': {'$gt': 4}}}
     assert not uni.check(spec, self.checkable)
Exemplo n.º 39
0
 def test_lte_eq(self):
     spec = {'uni': {'age': {'$lte': 3}}}
     assert uni.check(spec, self.checkable)
Exemplo n.º 40
0
 def test_lte_false(self):
     spec = {'uni': {'age': {'$lt': 2}}}
     assert not uni.check(spec, self.checkable)
Exemplo n.º 41
0
 def test_getitem(self):
     spec  = {'cow.size': 'extrabig'}
     assert uni.check(spec, self.checkable)
Exemplo n.º 42
0
 def test_getitem_false(self):
     spec  = {'cow.size': {'$ne': 'tiny'}}
     assert uni.check(spec, self.checkable)
Exemplo n.º 43
0
 def test_getitem_false(self):
     spec = {'cow.size': {'$ne': 'tiny'}}
     assert uni.check(spec, self.checkable)
Exemplo n.º 44
0
 def test_index_getattr_false(self):
     spec  = {'types.1.__name__': {'$ne': 'dict'}}
     assert uni.check(spec, self.checkable)
Exemplo n.º 45
0
 def test_ne_false(self):
     spec = {'uni': {'age': {'$ne': 3}}}
     assert not uni.check(spec, self.checkable)
Exemplo n.º 46
0
 def test_getitem(self):
     spec = {'cow.size': 'extrabig'}
     assert uni.check(spec, self.checkable)
Exemplo n.º 47
0
 def test_ne(self):
     spec = {'uni': {'age': {'$ne': 2}}}
     assert uni.check(spec, self.checkable)
Exemplo n.º 48
0
 def test_getattr_false(self):
     spec = {'type.__name__': {'$ne': 'list'}}
     assert uni.check(spec, self.checkable)
Exemplo n.º 49
0
 def test_in(self):
     spec = {'species': {'$in': ['cow', 'pig', 't-rex']}}
     assert uni.check(spec, self.checkable)