Repository: Stewori/pytypes

Issue:
TypeError: isinstance expected 2 arguments, got 1
Running [Usage example with decorator](https://github.com/Stewori/pytypes#usage-example-with-decorator) in readme gave following error for me.

```
Traceback (most recent call last):
  File "/tmp/tmp.py", line 31, in <module>
    pytypes.dump_cache()
NameError: name 'pytypes' is not defined
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/Users/qria/.venvs/jupyter2/lib/python3.6/site-packages/pytypes/typelogger.py", line 316, in _dump_module
    assumed_glbls, implicit_globals, assumed_typevars)
  File "/Users/qria/.venvs/jupyter2/lib/python3.6/site-packages/pytypes/typelogger.py", line 755, in dump
    assumed_globals, implicit_globals, assumed_typevars)
  File "/Users/qria/.venvs/jupyter2/lib/python3.6/site-packages/pytypes/typelogger.py", line 680, in dump
    assumed_globals, implicit_globals))
  File "/Users/qria/.venvs/jupyter2/lib/python3.6/site-packages/pytypes/typelogger.py", line 653, in _stub_src_annotations
    assumed_globals, implicit_globals), ' ...']
  File "/Users/qria/.venvs/jupyter2/lib/python3.6/site-packages/pytypes/typelogger.py", line 625, in _declaration
    if annotated else self._signature(), ':'))
  File "/Users/qria/.venvs/jupyter2/lib/python3.6/site-packages/pytypes/typelogger.py", line 597, in _annotated_signature
    tp_lst = _prepare_arg_types_list(combine_argtype(self.arg_type_observations),
  File "/Users/qria/.venvs/jupyter2/lib/python3.6/site-packages/pytypes/typelogger.py", line 149, in combine_argtype
    assert isinstance(is_Tuple(observations[0]))
TypeError: isinstance expected 2 arguments, got 1
```

I don't know much about this codebase but maybe you've intended `assert is_Tuple(observations[0])`? 


versions:

pytypes==1.0b4

Discussion:

Patch:
diff --git a/pytypes/typelogger.py b/pytypes/typelogger.py
index 078b521..3b3c774 100644
--- a/pytypes/typelogger.py
+++ b/pytypes/typelogger.py
@@ -146,7 +146,7 @@ def combine_argtype(observations):
     additional unification effort (e.g. can apply PEP 484 style numeric tower).
     """
     assert len(observations) > 0
-    assert isinstance(is_Tuple(observations[0]))
+    assert is_Tuple(observations[0])
     if len(observations) > 1:
         prms = [get_Tuple_params(observations[0])]
         ln = len(prms[0])


Test patch:
diff --git a/tests/test_typechecker.py b/tests/test_typechecker.py
index 7fb1565..7051409 100644
--- a/tests/test_typechecker.py
+++ b/tests/test_typechecker.py
@@ -4734,5 +4734,38 @@ class Test_utils(unittest.TestCase):
         self.assertFalse(pytypes.is_subtype(list, Wrapper))
 
 
+class Test_combine_argtype(unittest.TestCase):
+    def test_exceptions(self):
+        # Empty observations not allowed
+        with self.assertRaises(AssertionError):
+            pytypes.typelogger.combine_argtype([])
+
+        # Non tuple types not allowed
+        with self.assertRaises(AssertionError):
+            notTuple = typing.List[int]
+            pytypes.typelogger.combine_argtype([notTuple])
+
+        with self.assertRaises(AssertionError):
+            notTuple = typing.List[int]
+            pytypes.typelogger.combine_argtype([typing.Tuple[int], notTuple])
+
+    def test_function(self):
+        # If single observation is supplied it should return itself
+        self.assertEqual(
+            pytypes.typelogger.combine_argtype([typing.Tuple[int]]),
+            typing.Tuple[int],
+        )
+        # Observations should be unioned
+        self.assertEqual(
+            pytypes.typelogger.combine_argtype([typing.Tuple[int], typing.Tuple[str]]),
+            typing.Tuple[typing.Union[int, str]],
+        )
+        # Number classes should be combined as PEP 484 style numeric tower
+        self.assertEqual(
+            pytypes.typelogger.combine_argtype([typing.Tuple[int], typing.Tuple[float]]),
+            typing.Tuple[float],
+        )
+
+
 if __name__ == '__main__':
     unittest.main()