def test_mapbox_load_from_file_populates_input_text(self, mock_os_path): mock_os_path.exists.return_value = True trigram = Trigram() with patch.object(builtins, 'open', mock_open(read_data='three whole words')): trigram.load_from_file(filename='filename.txt') self.assertEqual('three whole words', trigram.input_text)
def test_mapbox_load_from_file_checks_for_file_existance( self, mock_os_path): mock_os_path.exists.return_value = True trigram = Trigram() with patch.object(builtins, 'open', mock_open(read_data='three whole words')): trigram.load_from_file(filename='filename.txt') mock_os_path.exists.assert_called_once_with('filename.txt')
def test_mapbox_load_from_file_populates_input_text(self, mock_os_path): mock_os_path.exists.return_value = True trigram = Trigram() with patch.object(builtins, "open", mock_open(read_data="three whole words")): trigram.load_from_file(filename="filename.txt") self.assertEqual("three whole words", trigram.input_text)
def test_mapbox_load_from_file_checks_for_file_existance(self, mock_os_path): mock_os_path.exists.return_value = True trigram = Trigram() with patch.object(builtins, "open", mock_open(read_data="three whole words")): trigram.load_from_file(filename="filename.txt") mock_os_path.exists.assert_called_once_with("filename.txt")