def test_lemmatize_observation(self): lines = """ RB women VBG increasing""" m = testsetup.mock_open() expected_calls = [mock.call().write("RB woman"), mock.call().write("\n"), mock.call().write("VBG increasing"), mock.call().write("\n")] with mock.patch(self._open_name, m, create=True): datautil.lemmatize_observations(lines.split("\n"), "mockoutput") self.assertEqual(expected_calls, m.mock_calls[2: -1])
def setUp(self): self._data=""" <s> <s> NNP Pierre NNP Vinken NNP Vinken , , CD 61 RB steadily VBG increasing NN net . .""" self._mock = testsetup.mock_open(data=StringIO(self._data)) self._open_name = "{0}.open".format(datautil.__name__)