def test_set_write_concern_as_safe_with_w(self): """Test the `set_write_concern_as_safe()` method with `w`.""" options = {'w': 1} set_write_concern_as_safe(options, False) self.assertEqual(options, {'safe': True}) options = {'w': 0} set_write_concern_as_safe(options, False) self.assertEqual(options, {'safe': False}) options = {'w': 0} set_write_concern_as_safe(options, True) self.assertEqual(options, {'safe': True})
def test_set_write_concern_as_safe(self): """Test the `set_write_concern_as_safe()` method.""" options = {'safe': True} set_write_concern_as_safe(options, False) self.assertEqual(options, {'safe': True}) options = {'safe': False} set_write_concern_as_safe(options, False) self.assertEqual(options, {'safe': False}) options = {'safe': False} set_write_concern_as_safe(options, True) self.assertEqual(options, {'safe': True})