Ejemplo n.º 1
0
 def test_method2(_self):
     with _self.allowExtra():  # <- allow unlimited number.
         differences = [
             datatest.Extra('foo'),
             datatest.Missing('bar'),
             datatest.Missing('baz'),
         ]
         raise datatest.DataError('some differences', differences)
Ejemplo n.º 2
0
 def test_method1(_self):
     with _self.allowExtra(3):
         differences = [
             datatest.Extra('foo'),
             datatest.Missing('bar'),
             datatest.Missing('baz'),
         ]
         raise datatest.DataError('some differences', differences)
Ejemplo n.º 3
0
 def test_method(_self):
     with _self.allowAny(2):  # <- allow two
         differences = [
             datatest.Missing('foo'),
             datatest.Missing('bar'),
             datatest.Missing('baz'),
         ]
         raise datatest.DataError('some differences', differences)
Ejemplo n.º 4
0
 def test_method2(_self):
     with _self.allowAny(4):  # <- allow four
         differences = [
             datatest.Extra('foo'),
             datatest.Missing('bar'),
             datatest.Invalid('baz'),
         ]
         raise datatest.DataError('some differences', differences)
Ejemplo n.º 5
0
 def test_passing(_self):
     with _self.allowAny(
             3, label1='a'):  # <- allow 3 where label1 equals 'a'
         differences = [
             datatest.Deviation(-1, 3, label1='a', label2='x'),
             datatest.Deviation(+1, 4, label1='a', label2='y'),
             datatest.Deviation(-2, 5, label1='a', label2='z'),
         ]
         raise datatest.DataError('some differences', differences)
Ejemplo n.º 6
0
 def test_fail_with_nonmatched(_self):
     with _self.allowAny(
             label1='a'
     ):  # <- allow unlimited where label1 equals 'a'
         differences = [
             datatest.Deviation(-1, 3, label1='a', label2='x'),
             datatest.Deviation(+1, 4, label1='a', label2='y'),
             datatest.Deviation(-2, 5, label1='b',
                                label2='z'),  # <- label='b'
         ]
         raise datatest.DataError('some differences', differences)