chore: replace result assertions (#1840)

* s/assert!\((.*)\.is_ok\(\)\);/\1.unwrap\(\);/g

* s/assert!\((.*)\.is_some\(\)\);/\1.unwrap\(\);/g
This commit is contained in:
Lei, HUANG
2023-06-27 19:14:48 +08:00
committed by GitHub
parent b737a240de
commit f287d3115b
92 changed files with 269 additions and 304 deletions

View File

@@ -201,11 +201,11 @@ def test(n):
// try to find and compile
let script = mgr.try_find_script_and_compile(schema, name).await.unwrap();
assert!(script.is_some());
let _ = script.unwrap();
{
let cached = mgr.compiled.read().unwrap();
assert!(cached.get(name).is_some());
let _ = cached.get(name).unwrap();
}
}
}

View File

@@ -512,6 +512,6 @@ def test(a, b, c, **params):
assert_eq!(copr.return_types, vec![None]);
assert_eq!(copr.kwarg, Some("params".to_string()));
assert_eq!(copr.script, script);
assert!(copr.code_obj.is_some());
let _ = copr.code_obj.unwrap();
}
}

View File

@@ -345,6 +345,6 @@ def a(cpu, mem, **kwargs):
&HashMap::from([("a".to_string(), "1".to_string())]),
);
dbg!(&ret);
assert!(ret.is_ok());
let _ = ret.unwrap();
}
}

View File

@@ -311,7 +311,7 @@ fn run_builtin_fn_testcases() {
let loc = loc.to_str().expect("Fail to parse path");
let mut file = File::open(loc).expect("Fail to open file");
let mut buf = String::new();
assert!(file.read_to_string(&mut buf).is_ok());
let _ = file.read_to_string(&mut buf).unwrap();
let testcases: Vec<TestCase> = from_ron_string(&buf).expect("Fail to convert to testcases");
let cached_vm = rustpython_vm::Interpreter::with_init(Default::default(), |vm| {
vm.add_native_module("greptime", Box::new(greptime_builtin::make_module));

View File

@@ -94,7 +94,7 @@ fn run_ron_testcases() {
let loc = loc.to_str().expect("Fail to parse path");
let mut file = File::open(loc).expect("Fail to open file");
let mut buf = String::new();
assert!(file.read_to_string(&mut buf).is_ok());
let _ = file.read_to_string(&mut buf).unwrap();
let testcases: Vec<TestCase> = from_ron_string(&buf).expect("Fail to convert to testcases");
info!("Read {} testcases from {}", testcases.len(), loc);
for testcase in testcases {