changeset 8004:280c8767e577

cleanup: use isinstance instead of comparing types From 2to3 idioms.
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 23 Nov 2019 22:21:28 +0100
parents 529917d31320
children 5a971de9741c
files kallithea/lib/rcmail/response.py kallithea/model/db.py kallithea/tests/vcs/test_git.py kallithea/tests/vcs/test_hg.py
diffstat 4 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/rcmail/response.py	Sat Nov 23 21:36:07 2019 +0100
+++ b/kallithea/lib/rcmail/response.py	Sat Nov 23 22:21:28 2019 +0100
@@ -422,7 +422,7 @@
         return ""
 
     encoder = Charset(DEFAULT_ENCODING)
-    if type(value) == list:
+    if isinstance(value, list):
         return separator.join(properly_encode_header(
             v, encoder, not_email) for v in value)
     else:
--- a/kallithea/model/db.py	Sat Nov 23 21:36:07 2019 +0100
+++ b/kallithea/model/db.py	Sat Nov 23 22:21:28 2019 +0100
@@ -205,7 +205,7 @@
 
     @validates('_app_settings_value')
     def validate_settings_value(self, key, val):
-        assert type(val) == unicode
+        assert isinstance(val, unicode)
         return val
 
     @hybrid_property
--- a/kallithea/tests/vcs/test_git.py	Sat Nov 23 21:36:07 2019 +0100
+++ b/kallithea/tests/vcs/test_git.py	Sat Nov 23 22:21:28 2019 +0100
@@ -590,17 +590,17 @@
 
     def test_commit_message_is_unicode(self):
         for cs in self.repo:
-            assert type(cs.message) == unicode
+            assert isinstance(cs.message, unicode)
 
     def test_changeset_author_is_unicode(self):
         for cs in self.repo:
-            assert type(cs.author) == unicode
+            assert isinstance(cs.author, unicode)
 
     def test_repo_files_content_is_unicode(self):
         changeset = self.repo.get_changeset()
         for node in changeset.get_node('/'):
             if node.is_file():
-                assert type(node.content) == unicode
+                assert isinstance(node.content, unicode)
 
     def test_wrong_path(self):
         # There is 'setup.py' in the root dir but not there:
--- a/kallithea/tests/vcs/test_hg.py	Sat Nov 23 21:36:07 2019 +0100
+++ b/kallithea/tests/vcs/test_hg.py	Sat Nov 23 22:21:28 2019 +0100
@@ -538,17 +538,17 @@
 
     def test_commit_message_is_unicode(self):
         for cm in self.repo:
-            assert type(cm.message) == unicode
+            assert isinstance(cm.message, unicode)
 
     def test_changeset_author_is_unicode(self):
         for cm in self.repo:
-            assert type(cm.author) == unicode
+            assert isinstance(cm.author, unicode)
 
     def test_repo_files_content_is_unicode(self):
         test_changeset = self.repo.get_changeset(100)
         for node in test_changeset.get_node('/'):
             if node.is_file():
-                assert type(node.content) == unicode
+                assert isinstance(node.content, unicode)
 
     def test_wrong_path(self):
         # There is 'setup.py' in the root dir but not there: