def testParseLibrary(self):
     self.assertEquals(
         LicenseBuilder._ParseLibrary('//a/b/third_party/libname1:c').group(
             1), 'libname1')
     self.assertEquals(
         LicenseBuilder._ParseLibrary(
             '//a/b/third_party/libname2:c(d)').group(1), 'libname2')
     self.assertEquals(
         LicenseBuilder._ParseLibrary(
             '//a/b/third_party/libname3/c:d(e)').group(1), 'libname3')
     self.assertEquals(
         LicenseBuilder._ParseLibrary('//a/b/not_third_party/c'), None)
 def testParseLibraryRegExNoMatchFallbacksToDefaultLibname(self):
   lib_dict = {
       'libname:foo.*': ['path/to/LICENSE'],
   }
   builder = LicenseBuilder([], [], lib_dict, {})
   self.assertEquals(
       builder._ParseLibrary('//a/b/third_party/libname:bar_java'), 'libname')
Example #3
0
 def testParseLibraryRegExMatchWithSubDirectory(self):
     lib_regex_dict = {
         'libname/foo:bar.*': ['path/to/LICENSE'],
     }
     builder = LicenseBuilder([], [], {}, lib_regex_dict)
     self.assertEquals(
         builder._ParseLibrary('//a/b/third_party/libname/foo:bar_java'),
         'libname/foo:bar.*')
Example #4
0
 def testParseLibrarySimpleMatch(self):
     builder = LicenseBuilder([], [], {}, {})
     self.assertEquals(builder._ParseLibrary('//a/b/third_party/libname:c'),
                       'libname')