MCPcopy Index your code
hub / github.com/python/cpython / test_constructor_with_iterable_argument

Method test_constructor_with_iterable_argument

Lib/test/test_array.py:1109–1127  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1107 )
1108
1109 def test_constructor_with_iterable_argument(self):
1110 a = array.array(self.typecode, iter(self.example))
1111 b = array.array(self.typecode, self.example)
1112 self.assertEqual(a, b)
1113
1114 # non-iterable argument
1115 self.assertRaises(TypeError, array.array, self.typecode, 10)
1116
1117 # pass through errors raised in __iter__
1118 class A:
1119 def __iter__(self):
1120 raise UnicodeError
1121 self.assertRaises(UnicodeError, array.array, self.typecode, A())
1122
1123 # pass through errors raised in next()
1124 def B():
1125 raise UnicodeError
1126 yield None
1127 self.assertRaises(UnicodeError, array.array, self.typecode, B())
1128
1129 def test_coveritertraverse(self):
1130 try:

Callers

nothing calls this directly

Calls 4

assertRaisesMethod · 0.95
AClass · 0.70
BClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected