def test_get_operrcls2(): cls, strings = get_operrcls2('abc %s def %d') assert strings == ("abc ", " def ", "") assert issubclass(cls, OperationError) inst = cls("w_type", strings, "hello", 42) assert inst._compute_value() == "abc hello def 42" cls2, strings2 = get_operrcls2('a %s b %d c') assert cls2 is cls # caching assert strings2 == ("a ", " b ", " c")