def test_format_compatibility(self): format_old_style_args = ['--format-markdown'] args = self.parser.parse_args(format_old_style_args) warn_string = create_warn_string(args) self.assertEqual('markdown', args.format) self.assertIn('deprecated', warn_string) format_old_style_args = ['--format-rst'] args = self.parser.parse_args(format_old_style_args) warn_string = create_warn_string(args) self.assertEqual('rst', args.format) self.assertIn('deprecated', warn_string) format_old_style_args = ['--format-confluence'] args = self.parser.parse_args(format_old_style_args) warn_string = create_warn_string(args) self.assertEqual('confluence', args.format) self.assertIn('deprecated', warn_string) format_old_style_args = ['--format-html'] args = self.parser.parse_args(format_old_style_args) warn_string = create_warn_string(args) self.assertEqual('html', args.format) self.assertIn('deprecated', warn_string) format_old_style_args = ['--format-json'] args = self.parser.parse_args(format_old_style_args) warn_string = create_warn_string(args) self.assertEqual('json', args.format) self.assertIn('deprecated', warn_string)
def test_summary_warning(self): summary_args = ['--summary', '--with-authors'] args = self.parser.parse_args(summary_args) warn_string = create_warn_string(args) self.assertIn('using --with-authors and --with-urls will be ignored.', warn_string) summary_args = ['--summary', '--with-urls'] args = self.parser.parse_args(summary_args) warn_string = create_warn_string(args) self.assertIn('using --with-authors and --with-urls will be ignored.', warn_string)
def test_from_compatibility(self): from_old_style_args = ['--from-classifier'] args = self.parser.parse_args(from_old_style_args) warn_string = create_warn_string(args) self.assertEqual('classifier', getattr(args, 'from')) self.assertIn('deprecated', warn_string)
def test_summary(self): summary_args = ['--summary'] args = self.parser.parse_args(summary_args) output_string = create_output_string(args) self.assertIn('Count', output_string) self.assertNotIn('Name', output_string) warn_string = create_warn_string(args) self.assertTrue(len(warn_string) == 0)
def test_with_license_file_warning(self): with_license_file_args = ['--with-license-file', '--format=markdown'] args = self.parser.parse_args(with_license_file_args) warn_string = create_warn_string(args) self.assertIn('best paired with --format=json', warn_string)