Repository: pydicom/pydicom

Issue:
[python 3.8] failing tests: various issues but "max recursion depth reached" seems to be one
#### Description
Fedora is beginning to test python packages against python 3.8. Pydicom builds but tests fail with errors.

#### Steps/Code to Reproduce

```
python setup.py build
python setup.py install
pytest
```

The complete build log is attached. It includes the complete build process. The root log is also attached. These are the versions of other python libraries that are in use:

```
python3-dateutil-1:2.8.0-5.fc32.noarch
python3-devel-3.8.0~b3-4.fc32.x86_64
python3-numpy-1:1.17.0-3.fc32.x86_64
python3-numpydoc-0.9.1-3.fc32.noarch
python3-pytest-4.6.5-3.fc32.noarch
python3-setuptools-41.0.1-8.fc32.noarch
python3-six-1.12.0-5.fc32.noarch
```

[build-log.txt](https://github.com/pydicom/pydicom/files/3527558/build-log.txt)
[root-log.txt](https://github.com/pydicom/pydicom/files/3527559/root-log.txt)


Discussion:
scaramallion: No coverage due to [bug ](https://github.com/codecov/codecov-bash/issues/198)in uploader...
sanjayankur31: Not a review, but I can confirm that this fixes the Fedora build with python3.8. I've cherry-picked the patch and will carry it until it gets included in a new release. Thanks very much!

https://koji.fedoraproject.org/koji/taskinfo?taskID=37218006
scaramallion: I pushed [another commit](https://github.com/pydicom/pydicom/compare/master...scaramallion:fix-py38) but its not showing up... I'm going to change back to WIP until things sort themselves out.

Patch:
diff --git a/pydicom/valuerep.py b/pydicom/valuerep.py
index 38e36fe30..f6491559b 100644
--- a/pydicom/valuerep.py
+++ b/pydicom/valuerep.py
@@ -346,11 +346,12 @@ class DSfloat(float):
     def __str__(self):
         if hasattr(self, 'original_string'):
             return self.original_string
-        else:
-            return super(DSfloat, self).__str__()
+
+        # Issue #937 (Python 3.8 compatibility)
+        return repr(self)[1:-1]
 
     def __repr__(self):
-        return "\"" + str(self) + "\""
+        return '"{}"'.format(super(DSfloat, self).__repr__())
 
 
 class DSdecimal(Decimal):
@@ -513,11 +514,15 @@ class IS(int):
         elif isinstance(val, IS) and hasattr(val, 'original_string'):
             self.original_string = val.original_string
 
-    def __repr__(self):
+    def __str__(self):
         if hasattr(self, 'original_string'):
-            return "\"" + self.original_string + "\""
-        else:
-            return "\"" + int.__str__(self) + "\""
+            return self.original_string
+
+        # Issue #937 (Python 3.8 compatibility)
+        return repr(self)[1:-1]
+
+    def __repr__(self):
+        return '"{}"'.format(super(IS, self).__repr__())
 
 
 def MultiString(val, valtype=str):


Test patch:
diff --git a/pydicom/tests/test_valuerep.py b/pydicom/tests/test_valuerep.py
index 3d7190f79..8fc76f2fd 100644
--- a/pydicom/tests/test_valuerep.py
+++ b/pydicom/tests/test_valuerep.py
@@ -90,7 +90,6 @@ class TestDA(object):
 
 class TestDS(object):
     """Unit tests for DS values"""
-
     def test_empty_value(self):
         assert DS(None) is None
         assert '' == DS('')
@@ -106,7 +105,6 @@ class TestDS(object):
 
 class TestDSfloat(object):
     """Unit tests for pickling DSfloat"""
-
     def test_pickling(self):
         # Check that a pickled DSFloat is read back properly
         x = pydicom.valuerep.DSfloat(9.0)
@@ -116,10 +114,25 @@ class TestDSfloat(object):
         assert x.real == x2.real
         assert x.original_string == x2.original_string
 
+    def test_str(self):
+        """Test DSfloat.__str__()."""
+        val = pydicom.valuerep.DSfloat(1.1)
+        assert '1.1' == str(val)
+
+        val = pydicom.valuerep.DSfloat('1.1')
+        assert '1.1' == str(val)
+
+    def test_repr(self):
+        """Test DSfloat.__repr__()."""
+        val = pydicom.valuerep.DSfloat(1.1)
+        assert '"1.1"' == repr(val)
+
+        val = pydicom.valuerep.DSfloat('1.1')
+        assert '"1.1"' == repr(val)
+
 
 class TestDSdecimal(object):
     """Unit tests for pickling DSdecimal"""
-
     def test_pickling(self):
         # Check that a pickled DSdecimal is read back properly
         # DSdecimal actually prefers original_string when
@@ -142,7 +155,6 @@ class TestDSdecimal(object):
 
 class TestIS(object):
     """Unit tests for IS"""
-
     def test_empty_value(self):
         assert IS(None) is None
         assert '' == IS('')
@@ -182,6 +194,22 @@ class TestIS(object):
             pydicom.valuerep.IS(3103050000)
         config.enforce_valid_values = original_flag
 
+    def test_str(self):
+        """Test IS.__str__()."""
+        val = pydicom.valuerep.IS(1)
+        assert '1' == str(val)
+
+        val = pydicom.valuerep.IS('1')
+        assert '1' == str(val)
+
+    def test_repr(self):
+        """Test IS.__repr__()."""
+        val = pydicom.valuerep.IS(1)
+        assert '"1"' == repr(val)
+
+        val = pydicom.valuerep.IS('1')
+        assert '"1"' == repr(val)
+
 
 class TestBadValueRead(object):
     """Unit tests for handling a bad value for a VR