mirror of
https://gitlab.com/news-flash/article_scraper.git
synced 2025-07-07 16:15:32 +02:00
fix tests
This commit is contained in:
parent
65b26370a2
commit
3e5654e197
2 changed files with 4 additions and 3 deletions
|
@ -288,7 +288,7 @@ impl FullTextParser {
|
|||
}
|
||||
}
|
||||
|
||||
fn parse_html_string_patched(
|
||||
pub(crate) fn parse_html_string_patched(
|
||||
input: &str,
|
||||
parser: &Parser,
|
||||
) -> Result<Document, libxml::parser::XmlParseError> {
|
||||
|
@ -691,6 +691,7 @@ impl FullTextParser {
|
|||
.ok()
|
||||
.and_then(|()| node.set_property("width", "100%").ok())
|
||||
.and_then(|()| node.set_property("height", "400").ok())
|
||||
.and_then(|()| node.remove_attribute("aspect-ratio").ok())
|
||||
.ok_or_else(|| {
|
||||
node.unlink();
|
||||
video_wrapper.add_child(&mut node)
|
||||
|
|
|
@ -1259,14 +1259,14 @@ impl Util {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use libxml::parser::Parser;
|
||||
|
||||
use crate::FullTextParser;
|
||||
use super::Util;
|
||||
|
||||
fn replace_brs(source: &str, expected: &str) {
|
||||
libxml::tree::node::set_node_rc_guard(10);
|
||||
|
||||
let parser = Parser::default_html();
|
||||
let document = parser.parse_string(source).unwrap();
|
||||
let document = FullTextParser::parse_html_string_patched(source, &parser).unwrap();
|
||||
let root = document.get_root_element().unwrap();
|
||||
let body = root.get_first_child().unwrap();
|
||||
let div = body.get_first_child().unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue