Lines Matching refs:first

142         # Swallows all but first exception. If a multi-exception handler
493 The default implementation of this method returns the first line of
788 The context manager keeps a reference to the first matching
817 logging.getLogger('foo').info('first message')
819 self.assertEqual(cm.output, ['INFO:foo:first message',
835 def _getAssertEqualityFunc(self, first, second):
838 Returns: A callable accepting (first, second, msg=None) that will
839 raise a failure exception if first != second with a useful human
843 # NOTE(gregory.p.smith): I considered isinstance(first, type(second))
852 if type(first) is type(second):
853 asserter = self._type_equality_funcs.get(type(first))
861 def _baseAssertEqual(self, first, second, msg=None):
863 if not first == second:
864 standardMsg = '%s != %s' % _common_shorten_repr(first, second)
868 def assertEqual(self, first, second, msg=None):
872 assertion_func = self._getAssertEqualityFunc(first, second)
873 assertion_func(first, second, msg=msg)
875 def assertNotEqual(self, first, second, msg=None):
879 if not first != second:
880 msg = self._formatMessage(msg, '%s == %s' % (safe_repr(first),
884 def assertAlmostEqual(self, first, second, places=None, msg=None,
898 if first == second:
904 diff = abs(first - second)
910 safe_repr(first),
922 safe_repr(first),
929 def assertNotAlmostEqual(self, first, second, places=None, msg=None,
943 diff = abs(first - second)
945 if not (first == second) and diff > delta:
948 safe_repr(first),
955 if not (first == second) and round(diff, places) != 0:
957 standardMsg = '%s == %s within %r places' % (safe_repr(first),
971 seq1: The first sequence to compare.
1015 differing += ('\nUnable to index element %d of first %s\n' %
1044 'of first %s\n' % (len2, seq_type_name))
1073 list1: The first list to compare.
1085 tuple1: The first tuple to compare.
1096 set1: The first set to compare.
1110 self.fail('first argument does not support set difference: %s' % e)
1124 lines.append('Items in the first set but not the second:')
1128 lines.append('Items in the second set but not the first:')
1203 def assertCountEqual(self, first, second, msg=None):
1207 self.assertEqual(Counter(list(first)),
1215 first_seq, second_seq = list(first), list(second)
1217 first = collections.Counter(first_seq)
1223 if first == second:
1235 def assertMultiLineEqual(self, first, second, msg=None):
1237 self.assertIsInstance(first, str, 'First argument is not a string')
1240 if first != second:
1242 if (len(first) > self._diffThreshold or
1244 self._baseAssertEqual(first, second, msg)
1245 firstlines = first.splitlines(keepends=True)
1247 if len(firstlines) == 1 and first.strip('\r\n') == first:
1248 firstlines = [first + '\n']
1250 standardMsg = '%s != %s' % _common_shorten_repr(first, second)