alamb commented on code in PR #17307: URL: https://github.com/apache/datafusion/pull/17307#discussion_r2300826022
########## datafusion/core/tests/catalog/memory.rs: ########## @@ -47,6 +47,20 @@ fn memory_catalog_dereg_nonempty_schema() { assert!(cat.deregister_schema("foo", true).unwrap().is_some()); } +#[test] +fn memory_catalog_dereg_nonempty_schema_with_table_removal() { + let cat = Arc::new(MemoryCatalogProvider::new()) as Arc<dyn CatalogProvider>; + + let schema = Arc::new(MemorySchemaProvider::new()) as Arc<dyn SchemaProvider>; + let test_table = + Arc::new(EmptyTable::new(Arc::new(Schema::empty()))) as Arc<dyn TableProvider>; + schema.register_table("t".into(), test_table).unwrap(); + + cat.register_schema("foo", schema.clone()).unwrap(); + schema.deregister_table("t").unwrap(); + assert!(cat.deregister_schema("foo", false).unwrap().is_some()); Review Comment: I see this just follows the pattern of the existing tests in this module, so that is good I think a better pattern for checking errors is to verify that the error is actually the error that is expected (to make sure it isn't an error in the test setup, for example). Something like ```suggestion let err = cat.deregister_schema("foo", false).unwrap_err().to_string(); assert!(err.contains("expected error message"), "Can't find expected in {err}")); ``` That would be a nice follow on PR -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org