+def precondition_abspath(path):
+ if not isinstance(path, unicode):
+ raise AssertionError("an abspath must be a Unicode string")
+
+ if sys.platform == "win32":
+ # This intentionally doesn't view absolute paths starting with a drive specification, or
+ # paths relative to the current drive, as acceptable.
+ if not path.startswith("\\\\"):
+ raise AssertionError("an abspath should be normalized using abspath_expanduser_unicode")
+ else:
+ # This intentionally doesn't view the path '~' or paths starting with '~/' as acceptable.
+ if not os.path.isabs(path):
+ raise AssertionError("an abspath should be normalized using abspath_expanduser_unicode")
+