Skip to content

Commit 328d61c

Browse files
committed
Fix test for python2
1 parent c868cc3 commit 328d61c

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tests/test_class_basics.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,17 @@ fn empty_class_in_module() {
6666
ty.getattr("__name__").unwrap().extract::<String>().unwrap(),
6767
"EmptyClassInModule"
6868
);
69+
70+
let builtin = if cfg!(feature = "python2") {
71+
"__builtin__"
72+
} else {
73+
"builtins"
74+
};
75+
76+
let module: String = ty.getattr("__module__").unwrap().extract().unwrap();
77+
6978
// Rationale: The class can be added to many modules, but will only be initialized once.
7079
// We currently have no way of determining a canonical module, so builtins is better
7180
// than using whatever calls init first.
72-
assert_eq!(
73-
ty.getattr("__module__")
74-
.unwrap()
75-
.extract::<String>()
76-
.unwrap(),
77-
"builtins"
78-
);
81+
assert_eq!(module, builtin);
7982
}

0 commit comments

Comments
 (0)