# unassigned attributes should throw as if the callee failed to look them up self.assertRaises(NameError, lambda : test_new_module.get_test_attr()) # unassigned builtins should return the built-in as if the caller looked them up self.assertEqual(test_new_module.get_min(), min) # we should be able to assign to values test_new_module.test_attr = 42 # and the built-in module should see them self.assertEqual(test_new_module.get_test_attr(), 42) self.assertEqual(test_new_module.test_attr, 42) # static members take precedence over things in globals self.assertEqual(test_new_module.test_overlap_method(), 42) self.assertEqual(type(test_new_module.test_overlap_type), type) test_new_module.inc_value() self.assertEqual(test_new_module.get_value(), 1) test_new_module.inc_value() self.assertEqual(test_new_module.get_value(), 2) # can't access private fields self.assertRaises(AttributeError, lambda : test_new_module._value) run_test(__name__) if __name__ == '__main__': from iptest.file_util import delete_all_f delete_all_f(__name__, remove_folders=True)