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))
def testStuboutMethodWithSmartSet(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))
def testStuboutMethodWithSet(self): non_existing_path = 'non_existing_path' self.assertFalse( mox3_stubout_example.check_if_exists(non_existing_path)) self.stubber.set(os.path, 'exists', lambda x: True) self.assertTrue( mox3_stubout_example.check_if_exists(non_existing_path)) self.stubber.unset_all() self.assertFalse( mox3_stubout_example.check_if_exists(non_existing_path))
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))
def testStuboutSubModuleWithSmartSet(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))