Index: tests/test_import_machinery.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- tests/test_import_machinery.py	(date 1453865457000)
+++ tests/test_import_machinery.py	(date 1453873531000)
@@ -3,10 +3,12 @@
 
 import sys
 import unittest
+import warnings
 
 import gi.overrides
 import gi.module
 import gi.importer
+from gi import PyGIWarning
 
 try:
     from gi.repository import Regress
@@ -134,17 +136,28 @@
     def test_require_version_warning(self):
         check = gi.importer._check_require_version
 
-        # make sure it doesn't fail at least
-        with check("GLib", 1):
-            from gi.repository import GLib
-            GLib
+        with check("Gdk", 3):
+            with warnings.catch_warnings(record=True) as warning:
+                from gi.repository import Gdk
+                _ = Gdk.Geometry()
+                self.assertTrue(issubclass(warning[0].category, PyGIWarning))
+                self.assertTrue('specifying a version first' in str(warning[0].message))
 
-        # make sure the exception propagates
-        with self.assertRaises(ImportError):
-            with check("InvalidGObjectRepositoryModuleName", 1):
-                from gi.repository import InvalidGObjectRepositoryModuleName
-                InvalidGObjectRepositoryModuleName
-
     def test_get_import_stacklevel(self):
         gi.importer.get_import_stacklevel(import_hook=True)
         gi.importer.get_import_stacklevel(import_hook=False)
+
+    def test_gi_require_version(self):
+        # Test possible arguments
+        gi.require_version('Gtk', '3.0')
+        gi.require_version('Gdk', '2.0', {'GLib': '2.0'})
+        gi.require_version({'AppStreamGlib': '1.0'})
+
+        # Test for properly raised exceptions
+        with self.assertRaises(ValueError) as context:
+            gi.require_version('Gtk')
+
+        exception_string = str(context.exception)
+        self.assertTrue('is not available' in exception_string)
+
+
