Lines Matching refs:assertEqual
24 self.assertEqual(str(''), '')
25 self.assertEqual(str(0), '0')
26 self.assertEqual(str(0L), '0')
27 self.assertEqual(str(()), '()')
28 self.assertEqual(str([]), '[]')
29 self.assertEqual(str({}), '{}')
32 self.assertEqual(str(a), '[[...]]')
35 self.assertEqual(str(a), '{0: {...}}')
105 self.assertEqual(str(Foo1()), "foo")
106 self.assertEqual(str(Foo2()), "foo")
107 self.assertEqual(str(Foo3()), "foo")
108 self.assertEqual(str(Foo4("bar")), "foo")
109 self.assertEqual(str(Foo5("bar")), "foo")
110 self.assertEqual(str(Foo6("bar")), "foos")
111 self.assertEqual(str(Foo7("bar")), "foos")
112 self.assertEqual(str(Foo8("foo")), "foofoo")
114 self.assertEqual(StrSubclass(Foo8("foo")), "foofoo")
116 self.assertEqual(str(Foo9("foo")), "string")
117 self.assertEqual(unicode(Foo9("foo")), u"not unicode")
130 self.assertEqual(value.__format__(format), expected)
131 self.assertEqual(value.__format__(format + 's'), expected)
160 self.assertEqual(''.format(), '')
161 self.assertEqual('a'.format(), 'a')
162 self.assertEqual('ab'.format(), 'ab')
163 self.assertEqual('a{{'.format(), 'a{')
164 self.assertEqual('a}}'.format(), 'a}')
165 self.assertEqual('{{b'.format(), '{b')
166 self.assertEqual('}}b'.format(), '}b')
167 self.assertEqual('a{{b'.format(), 'a{b')
171 self.assertEqual("My name is {0}".format('Fred'), "My name is Fred")
172 self.assertEqual("My name is {0[name]}".format(dict(name='Fred')),
174 self.assertEqual("My name is {0} :-{{}}".format('Fred'),
178 self.assertEqual("The year is {0.year}".format(d),
233 self.assertEqual(''.format(), '')
234 self.assertEqual('abc'.format(), 'abc')
235 self.assertEqual('{0}'.format('abc'), 'abc')
236 self.assertEqual('{0:}'.format('abc'), 'abc')
237 self.assertEqual('X{0}'.format('abc'), 'Xabc')
238 self.assertEqual('{0}X'.format('abc'), 'abcX')
239 self.assertEqual('X{0}Y'.format('abc'), 'XabcY')
240 self.assertEqual('{1}'.format(1, 'abc'), 'abc')
241 self.assertEqual('X{1}'.format(1, 'abc'), 'Xabc')
242 self.assertEqual('{1}X'.format(1, 'abc'), 'abcX')
243 self.assertEqual('X{1}Y'.format(1, 'abc'), 'XabcY')
244 self.assertEqual('{0}'.format(-15), '-15')
245 self.assertEqual('{0}{1}'.format(-15, 'abc'), '-15abc')
246 self.assertEqual('{0}X{1}'.format(-15, 'abc'), '-15Xabc')
247 self.assertEqual('{{'.format(), '{')
248 self.assertEqual('}}'.format(), '}')
249 self.assertEqual('{{}}'.format(), '{}')
250 self.assertEqual('{{x}}'.format(), '{x}')
251 self.assertEqual('{{{0}}}'.format(123), '{123}')
252 self.assertEqual('{{{{0}}}}'.format(), '{{0}}')
253 self.assertEqual('}}{{'.format(), '}{')
254 self.assertEqual('}}x{{'.format(), '}x{')
257 self.assertEqual("{0[foo-bar]}".format({'foo-bar':'baz'}), 'baz')
258 self.assertEqual("{0[foo bar]}".format({'foo bar':'baz'}), 'baz')
259 self.assertEqual("{0[ ]}".format({' ':3}), '3')
261 self.assertEqual('{foo._x}'.format(foo=C(20)), '20')
262 self.assertEqual('{1}{0}'.format(D(10), D(20)), '2010')
263 self.assertEqual('{0._x.x}'.format(C(D('abc'))), 'abc')
264 self.assertEqual('{0[0]}'.format(['abc', 'def']), 'abc')
265 self.assertEqual('{0[1]}'.format(['abc', 'def']), 'def')
266 self.assertEqual('{0[1][0]}'.format(['abc', ['def']]), 'def')
267 self.assertEqual('{0[1][0].x}'.format(['abc', [D('def')]]), 'def')
270 self.assertEqual('{0:.3s}'.format('abc'), 'abc')
271 self.assertEqual('{0:.3s}'.format('ab'), 'ab')
272 self.assertEqual('{0:.3s}'.format('abcdef'), 'abc')
273 self.assertEqual('{0:.0s}'.format('abcdef'), '')
274 self.assertEqual('{0:3.3s}'.format('abc'), 'abc')
275 self.assertEqual('{0:2.3s}'.format('abc'), 'abc')
276 self.assertEqual('{0:2.2s}'.format('abc'), 'ab')
277 self.assertEqual('{0:3.2s}'.format('abc'), 'ab ')
278 self.assertEqual('{0:x<0s}'.format('result'), 'result')
279 self.assertEqual('{0:x<5s}'.format('result'), 'result')
280 self.assertEqual('{0:x<6s}'.format('result'), 'result')
281 self.assertEqual('{0:x<7s}'.format('result'), 'resultx')
282 self.assertEqual('{0:x<8s}'.format('result'), 'resultxx')
283 self.assertEqual('{0: <7s}'.format('result'), 'result ')
284 self.assertEqual('{0:<7s}'.format('result'), 'result ')
285 self.assertEqual('{0:>7s}'.format('result'), ' result')
286 self.assertEqual('{0:>8s}'.format('result'), ' result')
287 self.assertEqual('{0:^8s}'.format('result'), ' result ')
288 self.assertEqual('{0:^9s}'.format('result'), ' result ')
289 self.assertEqual('{0:^10s}'.format('result'), ' result ')
290 self.assertEqual('{0:10000}'.format('a'), 'a' + ' ' * 9999)
291 self.assertEqual('{0:10000}'.format(''), ' ' * 10000)
292 self.assertEqual('{0:10000000}'.format(''), ' ' * 10000000)
295 self.assertEqual('{0:abc}'.format(C()), 'abc')
298 self.assertEqual('{0!s}'.format('Hello'), 'Hello')
299 self.assertEqual('{0!s:}'.format('Hello'), 'Hello')
300 self.assertEqual('{0!s:15}'.format('Hello'), 'Hello ')
301 self.assertEqual('{0!s:15s}'.format('Hello'), 'Hello ')
302 self.assertEqual('{0!r}'.format('Hello'), "'Hello'")
303 self.assertEqual('{0!r:}'.format('Hello'), "'Hello'")
304 self.assertEqual('{0!r}'.format(F('Hello')), 'F(Hello)')
307 self.assertEqual('{0}'.format({}), '{}')
308 self.assertEqual('{0}'.format([]), '[]')
309 self.assertEqual('{0}'.format([1]), '[1]')
310 self.assertEqual('{0}'.format(E('data')), 'E(data)')
311 self.assertEqual('{0:d}'.format(G('data')), 'G(data)')
312 self.assertEqual('{0!s}'.format(G('data')), 'string is data')
316 self.assertEqual('{0:^10}'.format(E('data')), ' E(data) ')
317 self.assertEqual('{0:^10s}'.format(E('data')), ' E(data) ')
318 self.assertEqual('{0:>15s}'.format(G('data')), ' string is data')
320 self.assertEqual("{0:date: %Y-%m-%d}".format(I(year=2007,
326 self.assertEqual("{0}".format(J(10)), "20")
330 self.assertEqual('{0:}'.format('a'), 'a')
333 self.assertEqual("{0:.{1}}".format('hello world', 5), 'hello')
334 self.assertEqual("{0:.{1}s}".format('hello world', 5), 'hello')
335 self.assertEqual("{0:.{precision}s}".format('hello world', precision=5), 'hello')
336 …self.assertEqual("{0:{width}.{precision}s}".format('hello world', width=10, precision=5), 'hello …
337 …self.assertEqual("{0:{width}.{precision}s}".format('hello world', width='10', precision='5'), 'hel…
414 self.assertEqual('{}'.format(10), '10')
415 self.assertEqual('{:5}'.format('s'), 's ')
416 self.assertEqual('{!r}'.format('s'), "'s'")
417 self.assertEqual('{._x}'.format(C(10)), '10')
418 self.assertEqual('{[1]}'.format([1, 2]), '2')
419 self.assertEqual('{[a]}'.format({'a':4, 'b':2}), '4')
420 self.assertEqual('a{}b{}c'.format(0, 1), 'a0b1c')
422 self.assertEqual('a{:{}}b'.format('x', '^10'), 'a x b')
423 self.assertEqual('a{:{}x}b'.format(20, '#'), 'a0x14b')
432 self.assertEqual('{f}{}'.format(4, f='test'), 'test4')
433 self.assertEqual('{}{f}'.format(4, f='test'), '4test')
434 self.assertEqual('{:{f}}{g}{}'.format(1, 3, g='g', f=2), ' 1g3')
435 self.assertEqual('{f:{}}{}{g}'.format(2, 4, f=1, g='g'), ' 14g')
446 self.assertEqual('abcde'.encode('ascii', 'replace'),
448 self.assertEqual('abcde'.encode('ascii', 'ignore'),
450 self.assertEqual('Andr\202 x'.decode('ascii', 'ignore'),
452 self.assertEqual('Andr\202 x'.decode('ascii', 'replace'),
474 self.assertEqual('lhs %% %r' % SubclassedStr('rhs'),