Blame SOURCES/955102b318a4ecc34afd0f366e826ef174fe647b.patch

159572
From 955102b318a4ecc34afd0f366e826ef174fe647b Mon Sep 17 00:00:00 2001
159572
From: xtreak <tir.karthi@gmail.com>
159572
Date: Sat, 29 Jun 2019 04:58:59 +0000
159572
Subject: [PATCH] Use context manager for assertWarns and fix
159572
 DeprecationWarning
159572
159572
---
159572
 pint/testsuite/parameterized.py | 7 ++++++-
159572
 pint/testsuite/test_quantity.py | 5 +++--
159572
 2 files changed, 9 insertions(+), 3 deletions(-)
159572
159572
diff --git a/pint/testsuite/parameterized.py b/pint/testsuite/parameterized.py
159572
index 9b920373..7c459157 100644
159572
--- a/pint/testsuite/parameterized.py
159572
+++ b/pint/testsuite/parameterized.py
159572
@@ -32,6 +32,11 @@
159572
 import collections
159572
 import unittest
159572
 
159572
+try:
159572
+    from collections.abc import Callable
159572
+except ImportError:
159572
+    from collections import Callable
159572
+
159572
 def add_metaclass(metaclass):
159572
     """Class decorator for creating a class with a metaclass."""
159572
     def wrapper(cls):
159572
@@ -69,7 +74,7 @@ def __new__(meta, classname, bases, class_dict):
159572
         new_class_dict = {}
159572
 
159572
         for attr_name, attr_value in list(class_dict.items()):
159572
-            if isinstance(attr_value, collections.Callable) and hasattr(attr_value, 'param_names'):
159572
+            if isinstance(attr_value, Callable) and hasattr(attr_value, 'param_names'):
159572
                 # print("Processing attr_name = %r; attr_value = %r" % (
159572
                 #     attr_name, attr_value))
159572
 
159572
diff --git a/pint/testsuite/test_quantity.py b/pint/testsuite/test_quantity.py
159572
index fdb24600..232eea2c 100644
159572
--- a/pint/testsuite/test_quantity.py
159572
+++ b/pint/testsuite/test_quantity.py
159572
@@ -383,7 +383,7 @@ def test_from_sequence(self):
159572
         self.assertFalse(u_array_2.u == u_array_ref_reversed.u)
159572
 
159572
         u_array_3 = self.Q_.from_sequence(u_seq_reversed, units='g')
159572
-        self.assertTrue(all(u_array_3 == u_array_ref_reversed))        
159572
+        self.assertTrue(all(u_array_3 == u_array_ref_reversed))
159572
         self.assertTrue(u_array_3.u == u_array_ref_reversed.u)
159572
 
159572
         with self.assertRaises(ValueError):
159572
@@ -454,7 +454,8 @@ def test_limits_magnitudes(self):
159572
     def test_nonnumeric_magnitudes(self):
159572
         ureg = self.ureg
159572
         x = "some string"*ureg.m
159572
-        self.assertRaises(RuntimeError, self.compareQuantity_compact(x,x))
159572
+        with self.assertWarns(RuntimeWarning):
159572
+            self.compareQuantity_compact(x,x)
159572
 
159572
 class TestQuantityBasicMath(QuantityTestCase):
159572