예제 #1
0
 def test_output_yaml(self, mock_dump, mock_print):
     wc.prose_wc(wc.setup(['-f', 'yaml', self.plaintext]))
     mock_dump.assert_called_once_with(
         {
             'counts': {
                 'file': self.plaintext,
                 'type': 'md/txt',
                 'words': 338,
                 'paragraphs': 7,
                 '_paragraphs': 'paragraphs',
                 'characters_total': 1729,
                 'characters_real': 1389
             }
         },
         default_flow_style=False,
         indent=4)
     self.assertTrue(mock_print.called_once)
예제 #2
0
 def test_output_json(self, mock_dump, mock_print):
     wc.prose_wc(wc.setup(['-f', 'json', self.plaintext]))
     self.assertTrue(mock_dump.called_once)
     self.assertTrue(mock_print.called_once)
예제 #3
0
 def test_split_hyphens(self, mock_dump, mock_print):
     with patch.object(wc, 'INTERSTITIAL_PUNCTUATION') as mock_ip:
         wc.prose_wc(wc.setup(['-S', self.plaintext]))
     self.assertTrue(mock_ip.append.called_once)
     self.assertTrue(mock_dump.called_once)
     self.assertTrue(mock_print.called_once)
예제 #4
0
 def test_output_default(self, mock_dump, mock_print):
     wc.prose_wc(wc.setup([self.plaintext]))
     self.assertTrue(mock_dump.called_once)
     self.assertTrue(mock_print.called_once)
예제 #5
0
 def test_update(self, mock_update):
     wc.prose_wc(wc.setup(['-u', self.jekyll]))
     self.assertTrue(mock_update.called_once)
예제 #6
0
 def test_no_file(self, mock_exit):
     with patch.object(sys, 'stderr'):
         self.assertEqual(wc.prose_wc(wc.setup(['-h'])), 1)