def testAddArgumentsValidAbsoluteErrorDefault(self): """Test Case: Valid command-line arguments using the absolute error flag where the default value is used for the absolute error""" A, B, absolute_error = self.setUpValidAbsoluteErrorDefault() args = jsondiff.add_arguments() self.assertEqual(args.json_files[0], A) self.assertEqual(args.json_files[1], B) self.assertEqual(args.absolute_error, float(absolute_error))
def testAddArgumentsValidRelativeError(self): """Test Case: Valid command-line arguments using the relative error flag where the user specifies the relative error""" A, B, relative_error = self.setUpValidRelativeError() args = jsondiff.add_arguments() self.assertEqual(args.json_files[0], A) self.assertEqual(args.json_files[1], B) self.assertEqual(args.relative_error, float(relative_error))
def testValidateFlagsOneFlag(self): """Test Case: Valid command-line arguments where either the --rel_tol or --abs_tol flag is used""" A, B, relative_error = self.setUpValidRelativeError() args = jsondiff.add_arguments() return_code = jsondiff.validate_flags(args, raise_on_error=True) self.assertEqual(return_code, 0)
def testValidateFlagsTwoFlagsRaiseOnError(self): """Test Case: Invalid command-line arguments where both the --rel_tol and --abs_tol flags are used and raises ValueError""" A, B = self.setUpTwoFlags() args = jsondiff.add_arguments() with self.assertRaises(ValueError): jsondiff.validate_flags(args, raise_on_error=True)
def testValidateFlagsTwoFlags(self): """Test Case: Invalid command-line arguments where both the --rel_tol and --abs_tol flags are used""" A, B = self.setUpTwoFlags() args = jsondiff.add_arguments() return_code = jsondiff.validate_flags(args) self.assertEqual(return_code, 1)