Asserts that the given tuple has been used in a test case.
177099
public void used( Tuple tuple)
    {
    // Currently unused?
    int i = unused_.indexOf( tuple);
    if( i >= 0)
      {
      // Yes, relocate to used list. 
      unused_.remove( i);
      addUsed( tuple);

      if( tuple.size() > 1)
        {
        // Once used, N-tuples can be reduced to 1-tuples.  This enables different combinations
        // that may be required to complete tests for other tuples. In particular, it allows for an
        // NA binding of an optional variable, which will never appear in N-tuples.
        for( Iterator<VarBindingDef> bindings = tuple.getBindings(); bindings.hasNext();)
          {
          Tuple tuple1 = new Tuple( bindings.next());
          tuple1.setOnce( tuple.isOnce());

          // 1-tuple already used?
          if( (i = used_.indexOf( tuple1)) >= 0)
            {
            // Yes, move to the end of the list. This acts to keep the used list
            // in least-recently-used-first order.
            used_.remove( i);
            }
          addUsed( tuple1);
          }
        }
      }

    // No, already used?
    else if( (i = used_.indexOf( tuple)) >= 0)
      {
      // Yes, move to the end of the list. This acts to keep the used list
      // in least-recently-used-first order.
      addUsed( used_.remove( i));
      }
    }
1194171
def ensure_tuple(obj):
    """"""
    if obj is None:
        return tuple()
    if isinstance(obj, Iterable) and not isinstance(obj, six.string_types):
        return tuple(obj)
    return obj,
1320991
def addFailure(self, test: unittest.case.TestCase, exc_info: tuple) -> None:
        
        # noinspection PyTypeChecker
        self.add_result(TestState.failure, test, exc_info)
738435
def assert_in(self, actual_collection_or_string, expected_value, failure_message='Expected "{1}" to be in "{0}"'):
        
        assertion = lambda: expected_value in actual_collection_or_string
        self.webdriver_assert(assertion, unicode(failure_message).format(actual_collection_or_string, expected_value))
1056771
def assert_valid(self, instance, value=None):
        """"""
        valid = super(Tuple, self).assert_valid(instance, value)
        if not valid:
            return False
        if value is None:
            value = instance._get(self.name)
            if value is None:
                return True
        if (
                (self.min_length is not None and len(value) < self.min_length)
                or
                (self.max_length is not None and len(value) > self.max_length)
        ):
            self.error(
                instance=instance,
                value=value,
                extra='(Length is {})'.format(len(value)),
            )
        for val in value:
            if not self.prop.assert_valid(instance, val):
                return False
        return True
945568
function assertOut(key, expected, result) {
  var actual = result[key];
  var statement = expected instanceof RegExp
    ? expected.test(actual)
    : expected === actual;

  if (statement !== true) {
    var message = 'Expected ' + key +' to match "' + expected + '". Actual: "' + actual + '"';
    return error(result, message, expected, actual);
  }
}
351825
private boolean completeSatisfied( TestCaseDef testCase, VarTupleSet tuples, List<VarDef> vars)
    {
    List<VarDef> varsRemaining = getVarsRemaining( vars, testCase);
    VarDef varApplicable;
    boolean complete; 

    // Any variables remaining unbound?
    if( varsRemaining.isEmpty())
      {
      // No, this test case is complete.
      complete = true;
      }
    
    // Any variables remaining that are currently applicable to this test case?
    else if( (varApplicable = varsRemaining.stream().filter( v -> testCase.isApplicable(v)).findFirst().orElse( null)) == null)
      {
      // No, continue with an NA binding for the next variable
      testCase.addCompatible( getNaBindingFor( varsRemaining.get( 0)));
      complete = makeComplete( testCase, tuples, varsRemaining);
      }

    else
      {
      // Find an applicable binding that will lead to a complete test case
      int prevBindings = testCase.getBindingCount();
      Iterator<Tuple> bindingTuples = getBindingsFor( tuples, varApplicable);
      for( complete = false;

           // More tuples to try?
           bindingTuples.hasNext()
             && !(
               // Compatible tuple found?
               testCase.addCompatible( (bindingTuples.next())) != null

               // Did this tuple create an infeasible combination?
               && !testCase.isInfeasible()

               // Can we complete bindings for remaining variables?
               && (complete = makeComplete( testCase, tuples, varsRemaining)));
             
           // No path to completion with this tuple -- try the next one.
           testCase.revertBindings( prevBindings));
      }
    
    return complete;
    }
315424
def raises(self, expected_exception):
        
        return unittest_case.assertRaises(expected_exception, self._orig_subject, *self._args, **self._kwargs)
1353025
def addError(self, test, error):
        
        # test_dict will be None if startTest wasn't called (i.e. exception in setUp/setUpClass)
        # status=BROKEN
        if self.current_sample is not None:
            assertion_name = error[0].__name__
            error_msg = str(error[1]).split('\n')[0]
            error_trace = self._get_trace(error)
            self.current_sample.add_assertion(assertion_name)
            self.current_sample.set_assertion_failed(assertion_name, error_msg, error_trace)
18565
def assert_is_instance(value, types, message=None, extra=None):
    """"""
    assert isinstance(value, types), _assert_fail_message(
        message, value, types, "is not an instance of", extra
    )
833083
def assert_any_call(self, *args, **kwargs):
        """"""
        expected = self._call_matcher((args, kwargs))
        actual = [self._call_matcher(c) for c in self.call_args_list]
        if expected not in actual:
            cause = expected if isinstance(expected, Exception) else None
            expected_string = self._format_mock_call_signature(args, kwargs)
            six.raise_from(AssertionError(
                '%s call not found' % expected_string
            ), cause)
149947
def assertit(self):
        """"""
        data = clips.data.DataObject(self._env)
        data.value = list(self._multifield)

        if lib.EnvPutFactSlot(
                self._env, self._fact, ffi.NULL, data.byref) != 1:
            raise CLIPSError(self._env)

        super(ImpliedFact, self).assertit()
20328
def _check_not_tuple_of_2_elements(obj, obj_name='obj'):
    """"""
    if not isinstance(obj, tuple) or len(obj) != 2:
        raise TypeError('%s must be a tuple of 2 elements.' % obj_name)
366285
def validate(self, instance, value):                                       #pylint: disable=inconsistent-return-statements
        """"""
        if not isinstance(value, string_types):
            self.error(instance, value)
        for key, val in self.choices.items():
            test_value = value if self.case_sensitive else value.upper()
            test_key = key if self.case_sensitive else key.upper()
            test_val = val if self.case_sensitive else [_.upper() for _ in val]
            if test_value == test_key or test_value in test_val:
                return key
        self.error(instance, value, extra='Not an available choice.')
1262996
function assert (value, expected, method, type, identifier) {
    if (value !== expected) {
      throw new Error(method + ' only accepts ' + type + ' as ' + identifier);
    }
  }
64079
def tuple_partial_cmp(target_tuple, tuple_list, ducktype):
    
    for called_tuple in tuple_list:
        # ignore invalid test case
        if len(target_tuple) > len(called_tuple):
            continue
        # loop all argument from "current arguments"
        dst = len(target_tuple)
        for idx, part_target_tuple in enumerate(target_tuple):
            # test current argument one by one, if matched to previous record, counter-1
            dtype = ducktype(part_target_tuple)
            if hasattr(dtype, "mtest"):
                if dtype.mtest(called_tuple[idx]):
                    dst = dst - 1
            else:
                if dtype == called_tuple[idx]:
                    dst = dst - 1
        # if counter is zero => arguments is partial matched => return True
        if not dst:
            return True
    # if no any arguments matched to called_tuple, return False
    return False
468639
def _ensure_ifaces_tuple(ifaces):
    """"""
    try:

        ifaces = tuple(ifaces)

    except TypeError:

        ifaces = (ifaces,)

    for iface in ifaces:

        if not _issubclass(iface, ibc.Iface):

            raise TypeError('Can only compare against interfaces.')

    return ifaces