Beispiel #1
0
 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))
Beispiel #2
0
 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))
Beispiel #3
0
 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)
Beispiel #4
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)
Beispiel #5
0
 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)