def test_multiple_singularity(self): """Multiple labels specified""" l = label(metadata={'ONE': 1, 'TWO': 2, 'THREE': 3}) self.assertEqual(str(l), '''%labels ONE 1 THREE 3 TWO 2''')
def test_multiple(self): """Multiple labels specified""" l = label(metadata={'ONE': 1, 'TWO': 2, 'THREE': 3}) self.assertEqual(l.toString(container_type.DOCKER), '''LABEL ONE=1 \\ THREE=3 \\ TWO=2''') self.assertEqual(l.toString(container_type.SINGULARITY), '''%labels ONE 1 THREE 3 TWO 2''')
def test_single(self): """Single label specified""" l = label(metadata={'A': 'B'}) self.assertEqual(l.toString(container_type.DOCKER), 'LABEL A=B') self.assertEqual(l.toString(container_type.SINGULARITY), '%labels\n A B')
def test_invalid_ctype(self): """Invalid container type specified""" l = label(metadata={'A': 'B'}) self.assertEqual(l.toString(None), '')
def test_empty(self): """No label specified""" l = label() self.assertEqual(l.toString(container_type.DOCKER), '')
def test_multiple_docker(self): """Multiple labels specified""" l = label(metadata={'ONE': 1, 'TWO': 2, 'THREE': 3}) self.assertEqual(str(l), '''LABEL ONE=1 \\ THREE=3 \\ TWO=2''')
def test_single_singularity(self): """Single label specified""" l = label(metadata={'A': 'B'}) self.assertEqual(str(l), '%labels\n A B')
def test_single_docker(self): """Single label specified""" l = label(metadata={'A': 'B'}) self.assertEqual(str(l), 'LABEL A=B')
def test_invalid_ctype(self): """Invalid container type specified""" l = label(metadata={'A': 'B'}) with self.assertRaises(RuntimeError): str(l)
def test_empty(self): """No label specified""" l = label() self.assertEqual(str(l), '')