diff --git a/comtypes/test/TestComServer.py b/comtypes/test/TestComServer.py
index 30a6e5784..a0bb8e224 100644
--- a/comtypes/test/TestComServer.py
+++ b/comtypes/test/TestComServer.py
@@ -1,5 +1,6 @@
-import sys, os
 import logging
+import os
+import sys
 
 logging.basicConfig()
 ##logging.basicConfig(level=logging.DEBUG)
@@ -7,14 +8,14 @@
 
 sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), r"..\..")))
 
-import ctypes
 import comtypes
-from comtypes.hresult import *
 import comtypes.client
+import comtypes.connectionpoints
 import comtypes.errorinfo
 import comtypes.server
 import comtypes.server.connectionpoints
 import comtypes.typeinfo
+from comtypes.hresult import S_OK
 
 ################################################################
 
@@ -30,6 +31,7 @@
 
 # Import the wrapper
 from comtypes.gen import TestComServerLib
+from comtypes.gen.TestComServerLib import ITestComServer  # noqa
 
 ################################################################
 
@@ -151,7 +153,4 @@ def MixedInOut(self, a, c):
         import traceback
 
         traceback.print_exc()
-        if sys.version_info >= (3, 0):
-            input()
-        else:
-            raw_input()
+        input()
diff --git a/comtypes/test/test_comserver.py b/comtypes/test/test_comserver.py
index 5d5191a38..3c4994411 100644
--- a/comtypes/test/test_comserver.py
+++ b/comtypes/test/test_comserver.py
@@ -3,10 +3,11 @@
 from ctypes import pointer
 from typing import Any
 
+import comtypes.server
 import comtypes.test.TestComServer
 from comtypes import BSTR
 from comtypes.automation import VARIANT, _midlSAFEARRAY
-from comtypes.client import CreateObject
+from comtypes.client import CreateObject, GetActiveObject
 from comtypes.server.register import register, unregister
 from comtypes.test.find_memleak import find_memleak
 
@@ -171,6 +172,35 @@ def test_mixedinout(self):
         pass
 
 
+class ActiveObjTest(unittest.TestCase):
+    def get_active_object(self) -> comtypes.test.TestComServer.ITestComServer:
+        return GetActiveObject(
+            comtypes.test.TestComServer.TestComServer,
+            interface=comtypes.test.TestComServer.ITestComServer,
+        )
+
+    def _doit(self, weak: bool):
+        comobj = comtypes.test.TestComServer.TestComServer()
+        with self.assertRaises(OSError):
+            self.get_active_object()
+        handle = comtypes.server.RegisterActiveObject(comobj, weak=weak)
+        activeobj = self.get_active_object()
+        self.assertEqual(activeobj.MixedInOut(2, 4), (3, 5))
+        self.assertEqual(activeobj.AddRef(), 3)
+        self.assertEqual(activeobj.Release(), 2)
+        punk = comobj.QueryInterface(comtypes.test.TestComServer.ITestComServer)
+        self.assertEqual(activeobj, punk)
+        comtypes.server.RevokeActiveObject(handle)
+        with self.assertRaises(OSError):
+            self.get_active_object()
+
+    def test_activeobj_weak_registration(self):
+        self._doit(weak=True)
+
+    def test_activeobj_strong_registration(self):
+        self._doit(weak=False)
+
+
 class VariantTest(unittest.TestCase):
     def test_UDT(self):
         from comtypes.gen.TestComServerLib import MYCOLOR