diff --git a/tests/test_class_basics.rs b/tests/test_class_basics.rs index 366bf9ad..d7d94d4c 100644 --- a/tests/test_class_basics.rs +++ b/tests/test_class_basics.rs @@ -66,14 +66,17 @@ fn empty_class_in_module() { ty.getattr("__name__").unwrap().extract::().unwrap(), "EmptyClassInModule" ); + + let builtin = if cfg!(feature = "python2") { + "__builtin__" + } else { + "builtins" + }; + + let module: String = ty.getattr("__module__").unwrap().extract().unwrap(); + // Rationale: The class can be added to many modules, but will only be initialized once. // We currently have no way of determining a canonical module, so builtins is better // than using whatever calls init first. - assert_eq!( - ty.getattr("__module__") - .unwrap() - .extract::() - .unwrap(), - "builtins" - ); + assert_eq!(module, builtin); }