def format_expected(self, expected, webasset):
from pyramid.path import AssetResolver<EOL>if '<STR_LIT:%>' not in expected:<EOL><INDENT>return expected<EOL><DEDENT>if '<STR_LIT::>' in webasset:<EOL><INDENT>name = AssetResolver(None).resolve(webasset).abspath()<EOL><DEDENT>else:<EOL><INDENT>name = self.temp.tempdir + '<STR_LIT>' + webasset<EOL><DEDENT>if webassets_version > (<NUM_LIT:0>, <NUM_LIT:9>):<EOL><INDENT>hashed_filename = hashlib.md5(name.encode("<STR_LIT:utf-8>")).hexdigest()<EOL><DEDENT>else:<EOL><INDENT>hashed_filename = hash(name) & ((<NUM_LIT:1> << <NUM_LIT:64>) - <NUM_LIT:1>)<EOL><DEDENT>external = '<STR_LIT>' % hashed_filename<EOL>return expected % {'<STR_LIT>': external}<EOL>
Formats the expected url when the webasset is external