Пример #1
0
 def test_stubout_method_with_smart_set(self):
     non_existing_path = 'non_existing_path'
     self.stubber.smart_set(os.path, 'exists', lambda x: True)
     self.assertTrue(
         mox3_stubout_example.check_if_exists(non_existing_path))
     self.stubber.smart_unset_all()
     self.assertFalse(
         mox3_stubout_example.check_if_exists(non_existing_path))
Пример #2
0
 def test_stubout_submodule_with_smart_set(self):
     # this one does not work with Set
     non_existing_path = 'non_existing_path'
     self.assertFalse(
         mox3_stubout_example.check_if_exists(non_existing_path))
     self.stubber.smart_set(os, 'path', ExistingPath)
     self.assertTrue(
         mox3_stubout_example.check_if_exists(non_existing_path))
     self.stubber.smart_unset_all()
     self.assertFalse(
         mox3_stubout_example.check_if_exists(non_existing_path))