コード例 #1
0
ファイル: test_trigram.py プロジェクト: xDD-CLE/katas
 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)
コード例 #2
0
ファイル: test_trigram.py プロジェクト: xDD-CLE/katas
 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')
コード例 #3
0
ファイル: test_trigram.py プロジェクト: xDD-CLE/katas
 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)
コード例 #4
0
ファイル: test_trigram.py プロジェクト: xDD-CLE/katas
 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")