I wrote several xslt files. Within each file, I have multiple templates to modify strings, so I am trying to find a way to create unit tests for these templates. Is there is a way to test xslt files in PyCharm with pytest?
Answering this for anyone else who wants to test xslt files in python using pytest: I am using lxml.etree
to parse the a sample XML file and the xslt file I have, then using lxml.etree.XSLT
and transform()
to transform the html output into an etree
object. I can compare what I expect to be within certain tags to what is actually there based on the xslt transformation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.