Skip to content

Commit 7b20b19

Browse files
committed
[IMP] tests for OLS01006
1 parent 7aef8e6 commit 7b20b19

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
class Cl():
3+
4+
def func(self):
5+
pass
6+
7+
class SubCl(Cl):
8+
pass
9+
10+
cl = Cl()
11+
subcl = SubCl()
12+
13+
super(SubCl, subcl).func() #working
14+
15+
super().func() #OLS01006

server/tests/diagnostics/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ pub mod ols01002;
55
pub mod ols01003;
66
pub mod ols01004;
77
pub mod ols01005;
8+
pub mod ols01006;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use std::env;
2+
3+
use lsp_types::{DiagnosticSeverity, NumberOrString};
4+
use odoo_ls_server::{S, utils::PathSanitizer};
5+
6+
use crate::{setup::setup::*, test_utils::diag_on_line};
7+
8+
#[test]
9+
fn test_ols01006() {
10+
let mut odoo = setup_server(false);
11+
let path = env::current_dir().unwrap().join("tests/data/python/diagnostics/ols01006.py").sanitize();
12+
let mut session = prepare_custom_entry_point(&mut odoo, &path);
13+
let diagnostics = get_diagnostics_for_path(&mut session, &path);
14+
assert_eq!(diagnostics.len(), 1);
15+
let diagnostics = diag_on_line(&diagnostics, 14);
16+
assert_eq!(diagnostics.len(), 1);
17+
let diag = &diagnostics[0];
18+
assert!(diag.code.is_some());
19+
let code = match &diag.code {
20+
Some(NumberOrString::String(code)) => code,
21+
Some(NumberOrString::Number(num)) => panic!("Unexpected numeric code: {}", num),
22+
None => panic!("Diagnostic code is None"),
23+
};
24+
assert!(code == &S!("OLS01006"));
25+
assert!(diag.severity.is_some_and(|s| s == DiagnosticSeverity::ERROR));
26+
}

0 commit comments

Comments
 (0)