~ubuntu-branches/ubuntu/utopic/python-django/utopic

« back to all changes in this revision

Viewing changes to django/utils/unittest/case.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (1.1.21) (4.4.27 sid)
  • Revision ID: package-import@ubuntu.com-20130509151047-aqv8d71oj9wvcv8c
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
324
324
            success = False
325
325
            try:
326
326
                self.setUp()
327
 
            except SkipTest, e:
 
327
            except SkipTest as e:
328
328
                self._addSkip(result, str(e))
329
329
            except Exception:
330
330
                result.addError(self, sys.exc_info())
333
333
                    testMethod()
334
334
                except self.failureException:
335
335
                    result.addFailure(self, sys.exc_info())
336
 
                except _ExpectedFailure, e:
 
336
                except _ExpectedFailure as e:
337
337
                    addExpectedFailure = getattr(result, 'addExpectedFailure', None)
338
338
                    if addExpectedFailure is not None:
339
339
                        addExpectedFailure(self, e.exc_info)
349
349
                        warnings.warn("Use of a TestResult without an addUnexpectedSuccess method is deprecated",
350
350
                                      DeprecationWarning)
351
351
                        result.addFailure(self, sys.exc_info())
352
 
                except SkipTest, e:
 
352
                except SkipTest as e:
353
353
                    self._addSkip(result, str(e))
354
354
                except Exception:
355
355
                    result.addError(self, sys.exc_info())
770
770
        """
771
771
        try:
772
772
            difference1 = set1.difference(set2)
773
 
        except TypeError, e:
 
773
        except TypeError as e:
774
774
            self.fail('invalid type when attempting set difference: %s' % e)
775
 
        except AttributeError, e:
 
775
        except AttributeError as e:
776
776
            self.fail('first argument does not support set difference: %s' % e)
777
777
 
778
778
        try:
779
779
            difference2 = set2.difference(set1)
780
 
        except TypeError, e:
 
780
        except TypeError as e:
781
781
            self.fail('invalid type when attempting set difference: %s' % e)
782
 
        except AttributeError, e:
 
782
        except AttributeError as e:
783
783
            self.fail('second argument does not support set difference: %s' % e)
784
784
 
785
785
        if not (difference1 or difference2):
980
980
            return _AssertRaisesContext(expected_exception, self, expected_regexp)
981
981
        try:
982
982
            callable_obj(*args, **kwargs)
983
 
        except expected_exception, exc_value:
 
983
        except expected_exception as exc_value:
984
984
            if isinstance(expected_regexp, basestring):
985
985
                expected_regexp = re.compile(expected_regexp)
986
986
            if not expected_regexp.search(str(exc_value)):