Beispiel #1
0
 def test_save_append(self):
     open_func = 'builtins.open'
     m = mock.mock_open()
     with mock.patch(open_func, m, create=True):
         pp.save_fields([self.pp_field], 'foo.pp', append=True)
     self.assertTrue(mock.call('foo.pp', 'ab') in m.mock_calls)
     self.assertTrue(mock.call().write('saved') in m.mock_calls)
Beispiel #2
0
 def test_save_append(self):
     open_func = "builtins.open"
     m = mock.mock_open()
     with mock.patch(open_func, m, create=True):
         pp.save_fields([self.pp_field], "foo.pp", append=True)
     self.assertTrue(mock.call("foo.pp", "ab") in m.mock_calls)
     self.assertTrue(mock.call().write("saved") in m.mock_calls)
Beispiel #3
0
 def test_save_append(self):
     if six.PY3:
         open_func = 'builtins.open'
     else:
         open_func = '__builtin__.open'
     m = mock.mock_open()
     with mock.patch(open_func, m, create=True):
         pp.save_fields([self.pp_field], 'foo.pp', append=True)
     self.assertTrue(mock.call('foo.pp', 'ab') in m.mock_calls)
     self.assertTrue(mock.call().write('saved') in m.mock_calls)
 def test_save(self):
     if six.PY3:
         open_func = 'builtins.open'
     else:
         open_func = '__builtin__.open'
     m = mock.mock_open()
     with mock.patch(open_func, m, create=True):
         pp.save_fields([self.pp_field], 'foo.pp')
     self.assertTrue(mock.call('foo.pp', 'wb') in m.mock_calls)
     self.assertTrue(mock.call().write('saved') in m.mock_calls)
Beispiel #5
0
 def test_save_append(self):
     m = mock.mock_open()
     with mock.patch('__builtin__.open', m, create=True):
         pp.save_fields([self.pp_field], 'foo.pp', append=True)
     self.assertTrue(call('foo.pp', 'ab') in m.mock_calls)
     self.assertTrue(call().write('saved') in m.mock_calls)
Beispiel #6
0
 def test_save_append(self):
     m = mock.mock_open()
     with mock.patch('__builtin__.open', m, create=True):
         pp.save_fields([self.pp_field], 'foo.pp', append=True)
     self.assertTrue(call('foo.pp', 'ab') in m.mock_calls)
     self.assertTrue(call().write('saved') in m.mock_calls)