示例#1
0
 def test_same_error(self):
     cupy_error = Exception()
     cupy_tb = 'xxxx'
     numpy_error = Exception()
     numpy_tb = 'yyyy'
     # Nothing happens
     helper._check_cupy_numpy_error(self, cupy_error, cupy_tb, numpy_error,
                                    numpy_tb)
示例#2
0
 def test_same_error(self):
     cupy_error = Exception()
     cupy_tb = 'xxxx'
     numpy_error = Exception()
     numpy_tb = 'yyyy'
     # Nothing happens
     helper._check_cupy_numpy_error(self, cupy_error, cupy_tb,
                                    numpy_error, numpy_tb)
示例#3
0
 def test_cupy_numpy_different_error(self):
     cupy_error = TypeError()
     cupy_tb = 'xxxx'
     numpy_error = ValueError()
     numpy_tb = 'yyyy'
     # Use re.S mode to ignore new line characters
     pattern = re.compile(cupy_tb + '.*' + numpy_tb, re.S)
     with six.assertRaisesRegex(self, AssertionError, pattern):
         helper._check_cupy_numpy_error(self, cupy_error, cupy_tb,
                                        numpy_error, numpy_tb)
示例#4
0
 def test_cupy_numpy_different_error(self):
     cupy_error = TypeError()
     cupy_tb = 'xxxx'
     numpy_error = ValueError()
     numpy_tb = 'yyyy'
     # Use re.S mode to ignore new line characters
     pattern = re.compile(cupy_tb + '.*' + numpy_tb, re.S)
     with self.assertRaisesRegexp(AssertionError, pattern):
         helper._check_cupy_numpy_error(self, cupy_error, cupy_tb,
                                        numpy_error, numpy_tb)
示例#5
0
 def test_forbidden_error(self):
     cupy_error = Exception()
     cupy_tb = 'xxxx'
     numpy_error = Exception()
     numpy_tb = 'yyyy'
     # Use re.S mode to ignore new line characters
     pattern = re.compile(cupy_tb + '.*' + numpy_tb, re.S)
     with self.assertRaisesRegexp(AssertionError, pattern):
         helper._check_cupy_numpy_error(
             self, cupy_error, cupy_tb,
             numpy_error, numpy_tb, accept_error=False)
示例#6
0
 def test_forbidden_error(self):
     cupy_error = Exception()
     cupy_tb = 'xxxx'
     numpy_error = Exception()
     numpy_tb = 'yyyy'
     # Use re.S mode to ignore new line characters
     pattern = re.compile(cupy_tb + '.*' + numpy_tb, re.S)
     with six.assertRaisesRegex(self, AssertionError, pattern):
         helper._check_cupy_numpy_error(
             self, cupy_error, cupy_tb,
             numpy_error, numpy_tb, accept_error=False)
示例#7
0
 def test_numpy_error(self):
     numpy_error = Exception()
     numpy_tb = 'yyyy'
     with six.assertRaisesRegex(self, AssertionError, numpy_tb):
         helper._check_cupy_numpy_error(self, None, None, numpy_error,
                                        numpy_tb)
示例#8
0
 def test_cupy_error(self):
     cupy_error = Exception()
     cupy_tb = 'xxxx'
     with six.assertRaisesRegex(self, AssertionError, cupy_tb):
         helper._check_cupy_numpy_error(self, cupy_error, cupy_tb, None,
                                        None)
示例#9
0
 def test_both_success(self):
     with self.assertRaises(AssertionError):
         helper._check_cupy_numpy_error(self, None, None, None, None)
示例#10
0
 def test_numpy_error(self):
     numpy_error = Exception()
     numpy_tb = 'yyyy'
     with self.assertRaisesRegexp(AssertionError, numpy_tb):
         helper._check_cupy_numpy_error(self, None, None,
                                        numpy_error, numpy_tb)
示例#11
0
 def test_cupy_error(self):
     cupy_error = Exception()
     cupy_tb = 'xxxx'
     with self.assertRaisesRegexp(AssertionError, cupy_tb):
         helper._check_cupy_numpy_error(self, cupy_error, cupy_tb,
                                        None, None)
示例#12
0
 def test_both_success(self):
     with self.assertRaises(AssertionError):
         helper._check_cupy_numpy_error(self, None, None, None, None)