def test_m2_string_representation(self):
    org_name_ref = M2Coordinate(org='org.example', name='lib', rev='the-rev')

    self.assertEqual('org.example:lib:the-rev', str(org_name_ref))
    self.assertEqual(org_name_ref, M2Coordinate.from_string(str(org_name_ref)))

    org_name_ref_classifier = M2Coordinate(org='org.example', name='lib',
                                           rev='the-rev', classifier='classify')

    self.assertEqual('org.example:lib:jar:classify:the-rev', str(org_name_ref_classifier))
    self.assertEqual(org_name_ref_classifier, M2Coordinate.from_string(str(org_name_ref_classifier)))

    org_name_classifier = M2Coordinate(org='org.example', name='lib', classifier='classify')

    self.assertEqual('org.example:lib:jar:classify:', str(org_name_classifier))
    self.assertEqual(org_name_classifier, M2Coordinate.from_string(str(org_name_classifier)))

    org_name_type_classifier = M2Coordinate(org='org.example', name='lib',
                                            classifier='classify', ext='zip')

    self.assertEqual('org.example:lib:zip:classify:', str(org_name_type_classifier))
    self.assertEqual(org_name_type_classifier, M2Coordinate.from_string(str(org_name_type_classifier)))

    org_name_type_jar_classifier = M2Coordinate(org='org.example', name='lib',
                                                classifier='classify', ext='jar')

    self.assertEqual('org.example:lib:jar:classify:', str(org_name_type_jar_classifier))
    self.assertEqual(org_name_type_jar_classifier, M2Coordinate.from_string(str(org_name_type_jar_classifier)))
 def to_m2_coord(cls, coord_str):
   return M2Coordinate.from_string(coord_str)
Exemple #3
0
 def m2_for(c):
   return M2Coordinate.from_string(c)
Exemple #4
0
 def to_m2_coord(cls, coord_str):
     return M2Coordinate.from_string(coord_str)
Exemple #5
0
 def m2_for(c):
   return M2Coordinate.from_string(c)
Exemple #6
0
 def to_m2_coord(cls, coord_str, classifier):
     # TODO: currently assuming all packaging is a jar
     return M2Coordinate.from_string(coord_str +
                                     ':{}:jar'.format(classifier))