예제 #1
0
 def test_document_required_fields(self):
     st = document.documents(required_fields={'test': json.nulls()})
     self.assertEqual(hypothesis.find(st, lambda _: True), {'test': None})
예제 #2
0
 def test_document_optional_fields(self):
     st = document.documents(optional_fields={'test': json.nulls()})
     self.assertEqual(hypothesis.find(st, lambda v: 'test' not in v),
                      {})
     self.assertEqual(hypothesis.find(st, lambda v: 'test' in v),
                      {'test': None})
예제 #3
0
 def test_objects_always_contains_required_fields(self):
     st = json.objects(required_fields={'test': json.nulls()})
     with self.assertRaises(NoSuchExample):
         hypothesis.find(st, lambda v: 'test' not in v)
예제 #4
0
 def test_objects_may_contains_optional_fields(self):
     st = json.objects(optional_fields={'test': json.nulls()})
     self.assertEqual(hypothesis.find(st, lambda v: 'test' not in v),
                      {})
     self.assertEqual(hypothesis.find(st, lambda v: 'test' in v),
                      {'test': None})
예제 #5
0
 def test_nulls(self):
     st = json.nulls()
     value = hypothesis.find(st, lambda _: True)
     self.assertIsNone(value)