From 915c5e44d24e56d43697926c72f337e869f6da45 Mon Sep 17 00:00:00 2001 From: cclauss Date: Thu, 12 Apr 2018 09:16:58 +0200 Subject: [PATCH] Use feature detection instead of version detection [Use feature detection instead of version detection](https://docs.python.org/3/howto/pyporting.html#use-feature-detection-instead-of-version-detection) --- test/test_api.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/test_api.py b/test/test_api.py index aac4540..ff562fc 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -6,9 +6,9 @@ else: import unittest -if sys.version_info[0] < 3: +try: STRING_TYPE = basestring -else: +except NameError: STRING_TYPE = str @@ -37,5 +37,6 @@ def test_dirs(self): self.assertIsInstance(dirs.user_state_dir, STRING_TYPE) self.assertIsInstance(dirs.user_log_dir, STRING_TYPE) + if __name__ == "__main__": unittest.main()