def test_provided_extension_should_be_used(self): my_remove('file.md') self.os_mock.remove.assert_called_once_with('file.md')
def test_provided_extension_should_be_used(self): with mock.patch('my_module.os') as os_mock: my_remove('file.md') os_mock.remove.assert_called_once_with('file.md')
def test_when_extension_is_missing_then_use_default_one(self): filename = 'file.txt' open(filename, 'w').close() self.assertTrue(os.path.isfile(filename)) my_remove('file') self.assertFalse(os.path.isfile(filename))
def test_when_extension_is_missing_then_use_default_one(self): my_remove('file') self.os_mock.remove.assert_called_once_with('file.txt')
def test_provided_extension_should_be_used(self): filename = 'file.md' open(filename, 'w').close() self.assertTrue(os.path.isfile(filename)) my_remove(filename) self.assertFalse(os.path.isfile(filename))