diff --git a/FWCore/ParameterSet/python/Types.py b/FWCore/ParameterSet/python/Types.py index aa3ae017d93b2..07dce4c862a7b 100644 --- a/FWCore/ParameterSet/python/Types.py +++ b/FWCore/ParameterSet/python/Types.py @@ -870,7 +870,7 @@ def insertInto(self, parameterSet, myname): parameterSet.addESInputTag(self.isTracked(), myname, self.cppTag(parameterSet)) class FileInPath(_SimpleParameterTypeBase): - def __init__(self,value): + def __init__(self,value=""): super(FileInPath,self).__init__(value) @staticmethod def _isValid(value): @@ -2189,6 +2189,9 @@ def testEDAlias(self): def testFileInPath(self): f = FileInPath("FWCore/ParameterSet/python/Types.py") self.assertEqual(f.configValue(), "'FWCore/ParameterSet/python/Types.py'") + f = FileInPath() + self.assertEqual(f.configValue(), "''") + def testSecSource(self): s1 = SecSource("EmbeddedRootSource", fileNames = vstring("foo.root")) self.assertEqual(s1.type_(), "EmbeddedRootSource") diff --git a/FWCore/ParameterSet/src/ParameterDescription.cc b/FWCore/ParameterSet/src/ParameterDescription.cc index 515a4c3f80df0..6dd18c869baf7 100644 --- a/FWCore/ParameterSet/src/ParameterDescription.cc +++ b/FWCore/ParameterSet/src/ParameterDescription.cc @@ -531,9 +531,7 @@ namespace edm { template <> void writeSingleValue(std::ostream& os, FileInPath const& value, ValueFormat) { - if (not value.relativePath().empty()) { - os << "'" << value.relativePath() << "'"; - } + os << "'" << value.relativePath() << "'"; } template diff --git a/FWCore/ParameterSet/test/test_catch_ParameterSetDescription.cc b/FWCore/ParameterSet/test/test_catch_ParameterSetDescription.cc index 7603a7bf4df00..2f5ac8638b2b2 100644 --- a/FWCore/ParameterSet/test/test_catch_ParameterSetDescription.cc +++ b/FWCore/ParameterSet/test/test_catch_ParameterSetDescription.cc @@ -1366,7 +1366,7 @@ vp = cms.VPSet( e = cms.EventID(1, 2, 3), er = cms.EventRange('1:2:3-4:5:6'), et = cms.ESInputTag('', 'foo'), - f = cms.FileInPath(), + f = cms.FileInPath(''), i = cms.int32(1), l = cms.int64(1), s = cms.string('a'),