bpo-43977: Make sure that tp_flags for pattern matching are inherited correctly. (GH-25813)

diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 98690d2..2ba1a19 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -1967,6 +1967,12 @@ def insert(self, index, value):
         self.assertEqual(len(mss), len(mss2))
         self.assertEqual(list(mss), list(mss2))
 
+    def test_illegal_patma_flags(self):
+        with self.assertRaises(TypeError):
+            class Both(Collection):
+                __abc_tpflags__ = (Sequence.__flags__ | Mapping.__flags__)
+
+
 
 ################################################################################
 ### Counter