Repository: lovasoa/marshmallow_dataclass (language: python)

Issue:
support "lowercase" subscribed containers
since python 3.9 you can use `list[foo]` instead of `typing.List[foo]` in annotations, as you can see in the [pep 585](https://www.python.org/dev/peps/pep-0585/).

unfortunately I see errors instead using this library. Example code:

```python
from marshmallow_dataclass import class_schema
from typing import List
from dataclasses import dataclass

@dataclass
class C1:
    lst: List[int]

@dataclass
class C2:
    lst: list[int]

class_schema(C1)().loads('{"lst":[1,2,3]}')
class_schema(C2)().loads('{"lst":[1,2,3]}')
```

I get no error from `C1`, but `AttributeError: type object 'list' has no attribute '__dataclass_fields__'` using `C2` (and a bit of `During handling of the above exception, another exception occurred:` related exceptions).

Using python `3.9.1`, `marshmallow==3.11.1`, `marshmallow-dataclass==8.4.1`


Discussion / hints:
Blocked by https://github.com/ilevkivskyi/typing_inspect/issues/65


Ping. Typing_inspect released `0.7.1` where they attempted to support builtin generics :-)
Btw: awesome library! ❤️ 

Yes, it should work now! Anyone interested in making a pull request?

Fix patch:
diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml
index e70bdda..7891d61 100644
--- a/.github/workflows/python-package.yml
+++ b/.github/workflows/python-package.yml
@@ -11,7 +11,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python_version: [3.6, 3.7, 3.8, pypy3]
+        python_version: [3.6, 3.7, 3.8, 3.9, pypy3]
 
     steps:
     - uses: actions/checkout@v2
diff --git a/setup.py b/setup.py
index d94d96a..0c79e3a 100644
--- a/setup.py
+++ b/setup.py
@@ -56,7 +56,7 @@
     classifiers=CLASSIFIERS,
     license="MIT",
     python_requires=">=3.6",
-    install_requires=["marshmallow>=3.0.0,<4.0", "typing-inspect>=0.7.0"],
+    install_requires=["marshmallow>=3.0.0,<4.0", "typing-inspect>=0.7.1"],
     extras_require=EXTRAS_REQUIRE,
     package_data={"marshmallow_dataclass": ["py.typed"]},
 )


Test patch:
diff --git a/tests/test_collection.py b/tests/test_collection.py
index f1e0f2a..594e8cb 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -1,4 +1,5 @@
 import itertools
+import sys
 import unittest
 from typing import Optional, Sequence, Set, FrozenSet, Mapping
 
@@ -336,3 +337,26 @@ class DataclassMapping:
             {"value": {1: {"name": "Doe"}}},
         ):
             self.assertEqual(schema.dump(schema.load(data_in)), data_in)
+
+
+class TestBuiltinGenerics(unittest.TestCase):
+    @unittest.skipIf(
+        sys.version_info < (3, 9),
+        "builtin generics are only available in python 3.9 upwards",
+    )
+    def test_builtin(self):
+        annotations = [list[int], dict[str, int], set[str]]
+        samples = [[1, 2, 3], {"foo": 1, "bar": 2}, {"f", "o", "b", "a", "r"}]
+
+        for annotation, sample in zip(annotations, samples):
+            with self.subTest(f"Testing {annotation}"):
+
+                @dataclass
+                class Dummy:
+                    value: annotation
+
+                schema = Dummy.Schema()
+
+                # check if a round trip keeps the data untouched
+                loaded = schema.load(schema.dump(Dummy(value=sample)))
+                self.assertEqual(loaded, Dummy(value=sample))