code: def test_commonprefix(self):
      commonprefix = self.pathmodule.commonprefix
      self.assertEqual(commonprefix([]), "")
      self.assertEqual(
          commonprefix(["/home/swenson/spam", "/home/swen/spam"]),
          "/home/swen",
      )
      self.assertEqual(
          commonprefix(["/home/swen/spam", "/home/swen/eggs"]),
          "/home/swen/",
      )
      self.assertEqual(
          commonprefix(["/home/swen/spam", "/home/swen/spam"]),
          "/home/swen/spam",
      )
      self.assertEqual(
          commonprefix(["home:swenson:spam", "home:swen:spam"]),
          "home:swen",
      )
      self.assertEqual(
          commonprefix([":home:swen:spam", ":home:swen:eggs"]),
          ":home:swen:",
      )
      self.assertEqual(
          commonprefix([":home:swen:spam", ":home:swen:spam"]),
          ":home:swen:spam",
      )
  
      self.assertEqual(
          commonprefix([b"/home/swenson/spam", b"/home/swen/spam"]),
          b"/home/swen",
      )
      self.assertEqual(
          commonprefix([b"/home/swen/spam", b"/home/swen/eggs"]),
          b"/home/swen/",
      )
      self.assertEqual(
          commonprefix([b"/home/swen/spam", b"/home/swen/spam"]),
          b"/home/swen/spam",
      )
      self.assertEqual(
          commonprefix([b"home:swenson:spam", b"home:swen:spam"]),
          b"home:swen",
      )
      self.assertEqual(
          commonprefix([b":home:swen:spam", b":home:swen:eggs"]),
          b":home:swen:",
      )
      self.assertEqual(
          commonprefix([b":home:swen:spam", b":home:swen:spam"]),
          b":home:swen:spam",
      )
  
      testlist = [
          "",
          "abc",
          "Xbcd",
          "Xb",
          "XY",
          "abcd",
          "aXc",
          "abd",
          "ab",
          "aX",
          "abcX",
      ]
      for s1 in testlist:
          for s2 in testlist:
              p = commonprefix([s1, s2])
              self.assertTrue(s1.startswith(p))
              self.assertTrue(s2.startswith(p))
              if s1 != s2:
                  n = len(p)
                  self.assertNotEqual(s1[n : n + 1], s2[n : n + 1])
  
imports: import genericpath
  import os
  import sys
  import unittest
  import warnings
  from test.support import is_emscripten
  from test.support import os_helper
  from test.support import warnings_helper
  from test.support.script_helper import assert_python_ok
  from test.support.os_helper import FakePath
label_desc: Use image node_id 2 for calling the GenericTest obj's underlying member method code with example usage: obj.test_commonprefix() without return types