Skip to content

Commit b3d7eab

Browse files
committed
Fix tests
1 parent b74eacb commit b3d7eab

File tree

1 file changed

+6
-111
lines changed

1 file changed

+6
-111
lines changed

nemo/src/io/formats/rdf/reader.rs

+6-111
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ impl ByteSized for RdfReader {
361361

362362
#[cfg(test)]
363363
mod test {
364-
use super::{RdfReader, DEFAULT_GRAPH};
364+
use super::{RdfReader, DEFAULT_GRAPH_IRI};
365365
use std::cell::RefCell;
366366

367367
use nemo_physical::{
@@ -447,7 +447,7 @@ mod test {
447447
let dict = RefCell::new(Dict::default());
448448
let mut tuple_writer = TupleWriter::new(&dict, 3);
449449
let mut null_map = NullMap::default();
450-
let graph_dv = AnyDataValue::new_iri(DEFAULT_GRAPH.to_string());
450+
let graph_dv = AnyDataValue::new_iri(DEFAULT_GRAPH_IRI.to_string());
451451

452452
// check that we use our own default graph IRI
453453
assert_eq!(
@@ -456,115 +456,10 @@ mod test {
456456
);
457457
// check that our default graph is a valid IRI in the first place
458458
assert_eq!(
459-
Iri::parse(DEFAULT_GRAPH.to_string()).unwrap().to_string(),
460-
DEFAULT_GRAPH.to_string()
459+
Iri::parse(DEFAULT_GRAPH_IRI.to_string())
460+
.unwrap()
461+
.to_string(),
462+
DEFAULT_GRAPH_IRI.to_string()
461463
);
462464
}
463-
464-
// #[test]
465-
// fn example_1() {
466-
// macro_rules! parse_example_with_rdf_parser {
467-
// ($data:tt, $make_parser:expr) => {
468-
// let $data = r#"<http://one.example/subject1> <http://one.example/predicate1> <http://one.example/object1> . # comments here
469-
// # or on a line by themselves
470-
// _:subject1 <http://an.example/predicate1> "object1" .
471-
// _:subject2 <http://an.example/predicate2> "object2" .
472-
// "#.as_bytes();
473-
474-
// let dict = RefCell::new(Dict::default());
475-
// let mut builders = vec![
476-
// PhysicalBuilderProxyEnum::String(PhysicalStringColumnBuilderProxy::new(&dict)),
477-
// PhysicalBuilderProxyEnum::String(PhysicalStringColumnBuilderProxy::new(&dict)),
478-
// PhysicalBuilderProxyEnum::String(PhysicalStringColumnBuilderProxy::new(&dict)),
479-
// ];
480-
// let reader = RDFReader::new(ResourceProviders::empty(), String::new(), None, vec![PrimitiveType::Any, PrimitiveType::Any, PrimitiveType::Any]);
481-
482-
// let result = reader.read_triples_with_parser(&mut builders, $make_parser);
483-
// assert!(result.is_ok());
484-
485-
// let columns = builders
486-
// .into_iter()
487-
// .map(|builder| match builder {
488-
// PhysicalBuilderProxyEnum::String(b) => b.finalize(),
489-
// _ => unreachable!("only string columns here"),
490-
// })
491-
// .collect::<Vec<_>>();
492-
493-
// log::debug!("columns: {columns:?}");
494-
// let triples = (0..=2)
495-
// .map(|idx| {
496-
// columns
497-
// .iter()
498-
// .map(|column| {
499-
// column
500-
// .get(idx)
501-
// .and_then(|value| value.try_into().ok())
502-
// .and_then(|u64: u64| usize::try_from(u64).ok())
503-
// .and_then(|usize| dict.borrow_mut().get(usize))
504-
// .unwrap()
505-
// })
506-
// .map(PhysicalString::from)
507-
// .collect::<Vec<_>>()
508-
// })
509-
// .collect::<Vec<_>>();
510-
// log::debug!("triple: {triples:?}");
511-
// for (value, expected) in PrimitiveType::Any.serialize_output(DataValueIteratorT::String(Box::new(triples[0].iter().cloned()))).zip(vec!["http://one.example/subject1", "http://one.example/predicate1", "http://one.example/object1"]) {
512-
// assert_eq!(value, expected);
513-
// }
514-
// for (value, expected) in PrimitiveType::Any.serialize_output(DataValueIteratorT::String(Box::new(triples[1].iter().cloned()))).zip(vec!["_:subject1", "http://an.example/predicate1", r#""object1""#]) {
515-
// assert_eq!(value, expected);
516-
// }
517-
// for (value, expected) in PrimitiveType::Any.serialize_output(DataValueIteratorT::String(Box::new(triples[2].iter().cloned()))).zip(vec!["_:subject2", "http://an.example/predicate2", r#""object2""#]) {
518-
// assert_eq!(value, expected);
519-
// }
520-
// };
521-
// }
522-
523-
// parse_example_with_rdf_parser!(reader, || NTriplesParser::new(reader));
524-
// parse_example_with_rdf_parser!(reader, || TurtleParser::new(reader, None));
525-
// }
526-
527-
// #[test]
528-
// fn rollback() {
529-
// let data = r#"<http://example.org/> <http://example.org/> <http://example.org/> .
530-
// malformed <http://example.org/> <http://example.org/>
531-
// <http://example.org/> malformed <http://example.org/> .
532-
// <http://example.org/> <http://example.org/> malformed .
533-
// <http://example.org/> <http://example.org/> "123"^^<http://www.w3.org/2001/XMLSchema#integer> .
534-
// <http://example.org/> <http://example.org/> "123.45"^^<http://www.w3.org/2001/XMLSchema#integer> .
535-
// <http://example.org/> <http://example.org/> "123.45"^^<http://www.w3.org/2001/XMLSchema#decimal> .
536-
// <http://example.org/> <http://example.org/> "123.45a"^^<http://www.w3.org/2001/XMLSchema#decimal> .
537-
// <https://example.org/> <https://example.org/> <https://example.org/> .
538-
// "#
539-
// .as_bytes();
540-
541-
// let dict = RefCell::new(Dict::default());
542-
// let mut builders = vec![
543-
// PhysicalBuilderProxyEnum::String(PhysicalStringColumnBuilderProxy::new(&dict)),
544-
// PhysicalBuilderProxyEnum::String(PhysicalStringColumnBuilderProxy::new(&dict)),
545-
// PhysicalBuilderProxyEnum::String(PhysicalStringColumnBuilderProxy::new(&dict)),
546-
// ];
547-
// let reader = RDFReader::new(
548-
// ResourceProviders::empty(),
549-
// String::new(),
550-
// None,
551-
// vec![PrimitiveType::Any, PrimitiveType::Any, PrimitiveType::Any],
552-
// );
553-
554-
// let result = reader.read_triples_with_parser(&mut builders, || NTriplesParser::new(data));
555-
// assert!(result.is_ok());
556-
557-
// let columns = builders
558-
// .into_iter()
559-
// .map(|builder| match builder {
560-
// PhysicalBuilderProxyEnum::String(b) => b.finalize(),
561-
// _ => unreachable!("only string columns here"),
562-
// })
563-
// .collect::<Vec<_>>();
564-
565-
// assert_eq!(columns.len(), 3);
566-
// assert_eq!(columns[0].len(), 4);
567-
// assert_eq!(columns[1].len(), 4);
568-
// assert_eq!(columns[2].len(), 4);
569-
// }
570465
}

0 commit comments

Comments
 (0)