def test_substitutions(self): sub = Substitutions() sub.load_substitutions(os.path.dirname(__file__) + os.sep + "subs.txt") self.assertEquals("My name is Fred West", sub.replace("My name is $FIRSTNAME $SURNAME")) self.assertEquals("My name is FredWest", sub.replace("My name is $FIRSTNAME$SURNAME"))
def _replace_subs(self, subs: Substitutions, value): if subs is not None: return subs.replace(value) return value