Example #1
0
 def test_strictmodule_patch_enabled(self):
     foo = create_strict_module(x=1, enable_patching=True)
     strict_module_patch(foo, "x", 2)
     self.assertEqual(foo.x, 2)
Example #2
0
 def test_strictmodule_patch_enabled(self):
     foo = strict_module_from_module(ModuleType("a"), enable_patching=True)
     strict_module_patch(foo, "__dir__", 2)
     self.assertEqual(foo.__dir__, 2)
Example #3
0
 def test_strictmodule_patch_disabled(self):
     foo = create_strict_module(x=1)
     with self.assertRaises(AttributeError):
         strict_module_patch(foo, "x", 2)