tests: Split large tests into smaller files, to run with a small heap.
All tests in basics/ directory can now run and pass using 64-bit unix port with only a 16k heap (./run-tests --heapsize 16k). Tests in this directory should remain small so they can be used for ports with a small heap.
This commit is contained in:
parent
9996adc37d
commit
ab69ed7dac
@ -97,104 +97,3 @@ try:
|
||||
raise LookupError
|
||||
except LookupError:
|
||||
print("Caught LookupError")
|
||||
|
||||
try:
|
||||
raise MemoryError
|
||||
except Exception:
|
||||
print("Caught MemoryError via Exception")
|
||||
|
||||
try:
|
||||
raise MemoryError
|
||||
except MemoryError:
|
||||
print("Caught MemoryError")
|
||||
|
||||
try:
|
||||
raise NameError
|
||||
except Exception:
|
||||
print("Caught NameError via Exception")
|
||||
|
||||
try:
|
||||
raise NameError
|
||||
except NameError:
|
||||
print("Caught NameError")
|
||||
|
||||
try:
|
||||
raise NotImplementedError
|
||||
except RuntimeError:
|
||||
print("Caught NotImplementedError via RuntimeError")
|
||||
|
||||
try:
|
||||
raise NotImplementedError
|
||||
except NotImplementedError:
|
||||
print("Caught NotImplementedError")
|
||||
|
||||
try:
|
||||
raise OSError
|
||||
except Exception:
|
||||
print("Caught OSError via Exception")
|
||||
|
||||
try:
|
||||
raise OSError
|
||||
except OSError:
|
||||
print("Caught OSError")
|
||||
|
||||
try:
|
||||
raise OverflowError
|
||||
except ArithmeticError:
|
||||
print("Caught OverflowError via ArithmeticError")
|
||||
|
||||
try:
|
||||
raise OverflowError
|
||||
except OverflowError:
|
||||
print("Caught OverflowError")
|
||||
|
||||
try:
|
||||
raise RuntimeError
|
||||
except Exception:
|
||||
print("Caught RuntimeError via Exception")
|
||||
|
||||
try:
|
||||
raise RuntimeError
|
||||
except RuntimeError:
|
||||
print("Caught RuntimeError")
|
||||
|
||||
try:
|
||||
raise SyntaxError
|
||||
except Exception:
|
||||
print("Caught SyntaxError via Exception")
|
||||
|
||||
try:
|
||||
raise SyntaxError
|
||||
except SyntaxError:
|
||||
print("Caught SyntaxError")
|
||||
|
||||
try:
|
||||
raise TypeError
|
||||
except Exception:
|
||||
print("Caught TypeError via Exception")
|
||||
|
||||
try:
|
||||
raise TypeError
|
||||
except TypeError:
|
||||
print("Caught TypeError")
|
||||
|
||||
try:
|
||||
raise ValueError
|
||||
except Exception:
|
||||
print("Caught ValueError via Exception")
|
||||
|
||||
try:
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
print("Caught ValueError")
|
||||
|
||||
try:
|
||||
raise ZeroDivisionError
|
||||
except ArithmeticError:
|
||||
print("Caught ZeroDivisionError via ArithmeticError")
|
||||
|
||||
try:
|
||||
raise ZeroDivisionError
|
||||
except ZeroDivisionError:
|
||||
print("Caught ZeroDivisionError")
|
||||
|
||||
|
99
tests/basics/exceptpoly2.py
Normal file
99
tests/basics/exceptpoly2.py
Normal file
@ -0,0 +1,99 @@
|
||||
try:
|
||||
raise MemoryError
|
||||
except Exception:
|
||||
print("Caught MemoryError via Exception")
|
||||
|
||||
try:
|
||||
raise MemoryError
|
||||
except MemoryError:
|
||||
print("Caught MemoryError")
|
||||
|
||||
try:
|
||||
raise NameError
|
||||
except Exception:
|
||||
print("Caught NameError via Exception")
|
||||
|
||||
try:
|
||||
raise NameError
|
||||
except NameError:
|
||||
print("Caught NameError")
|
||||
|
||||
try:
|
||||
raise NotImplementedError
|
||||
except RuntimeError:
|
||||
print("Caught NotImplementedError via RuntimeError")
|
||||
|
||||
try:
|
||||
raise NotImplementedError
|
||||
except NotImplementedError:
|
||||
print("Caught NotImplementedError")
|
||||
|
||||
try:
|
||||
raise OSError
|
||||
except Exception:
|
||||
print("Caught OSError via Exception")
|
||||
|
||||
try:
|
||||
raise OSError
|
||||
except OSError:
|
||||
print("Caught OSError")
|
||||
|
||||
try:
|
||||
raise OverflowError
|
||||
except ArithmeticError:
|
||||
print("Caught OverflowError via ArithmeticError")
|
||||
|
||||
try:
|
||||
raise OverflowError
|
||||
except OverflowError:
|
||||
print("Caught OverflowError")
|
||||
|
||||
try:
|
||||
raise RuntimeError
|
||||
except Exception:
|
||||
print("Caught RuntimeError via Exception")
|
||||
|
||||
try:
|
||||
raise RuntimeError
|
||||
except RuntimeError:
|
||||
print("Caught RuntimeError")
|
||||
|
||||
try:
|
||||
raise SyntaxError
|
||||
except Exception:
|
||||
print("Caught SyntaxError via Exception")
|
||||
|
||||
try:
|
||||
raise SyntaxError
|
||||
except SyntaxError:
|
||||
print("Caught SyntaxError")
|
||||
|
||||
try:
|
||||
raise TypeError
|
||||
except Exception:
|
||||
print("Caught TypeError via Exception")
|
||||
|
||||
try:
|
||||
raise TypeError
|
||||
except TypeError:
|
||||
print("Caught TypeError")
|
||||
|
||||
try:
|
||||
raise ValueError
|
||||
except Exception:
|
||||
print("Caught ValueError via Exception")
|
||||
|
||||
try:
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
print("Caught ValueError")
|
||||
|
||||
try:
|
||||
raise ZeroDivisionError
|
||||
except ArithmeticError:
|
||||
print("Caught ZeroDivisionError via ArithmeticError")
|
||||
|
||||
try:
|
||||
raise ZeroDivisionError
|
||||
except ZeroDivisionError:
|
||||
print("Caught ZeroDivisionError")
|
@ -39,107 +39,3 @@ print((-a) & (-0xffffffffffffffffffffffffffffffff))
|
||||
print((-1) & (-0xffffffffffffffffffffffffffffffff))
|
||||
print((-a) & (-2))
|
||||
print((-mpz) & (-2))
|
||||
|
||||
# test + +
|
||||
|
||||
print( 97989513389222316022151446562729620153292831887555425160965597396
|
||||
& 23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( 53817081128841898634258263553430908085326601592682411889506742059
|
||||
& 37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( 26167512042587370698808974207700979337713004510730289760097826496
|
||||
& 98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( 21085380307304977067262070503651827226504797285572981274069266136
|
||||
& 15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( 40827393422334167255488276244226338235131323044408420081160772273
|
||||
& 63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( 5181013159871685724135944379095645225188360725917119022722046448
|
||||
& 59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( 283894311
|
||||
& 86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( 40019818573920230246248826511203818792007462193311949166285967147
|
||||
& 9487909752)
|
||||
|
||||
# test - +
|
||||
|
||||
print( -97989513389222316022151446562729620153292831887555425160965597396
|
||||
& 23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( -53817081128841898634258263553430908085326601592682411889506742059
|
||||
& 37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( -26167512042587370698808974207700979337713004510730289760097826496
|
||||
& 98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( -21085380307304977067262070503651827226504797285572981274069266136
|
||||
& 15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( -40827393422334167255488276244226338235131323044408420081160772273
|
||||
& 63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( -5181013159871685724135944379095645225188360725917119022722046448
|
||||
& 59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( -283894311
|
||||
& 86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( -40019818573920230246248826511203818792007462193311949166285967147
|
||||
& 9487909752)
|
||||
|
||||
# test + -
|
||||
|
||||
print( 97989513389222316022151446562729620153292831887555425160965597396
|
||||
& -23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( 53817081128841898634258263553430908085326601592682411889506742059
|
||||
& -37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( 26167512042587370698808974207700979337713004510730289760097826496
|
||||
& -98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( 21085380307304977067262070503651827226504797285572981274069266136
|
||||
& -15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( 40827393422334167255488276244226338235131323044408420081160772273
|
||||
& -63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( 5181013159871685724135944379095645225188360725917119022722046448
|
||||
& -59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( 283894311
|
||||
& -86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( 40019818573920230246248826511203818792007462193311949166285967147
|
||||
& -9487909752)
|
||||
|
||||
# test - -
|
||||
|
||||
print( -97989513389222316022151446562729620153292831887555425160965597396
|
||||
& -23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( -53817081128841898634258263553430908085326601592682411889506742059
|
||||
& -37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( -26167512042587370698808974207700979337713004510730289760097826496
|
||||
& -98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( -21085380307304977067262070503651827226504797285572981274069266136
|
||||
& -15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( -40827393422334167255488276244226338235131323044408420081160772273
|
||||
& -63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( -5181013159871685724135944379095645225188360725917119022722046448
|
||||
& -59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( -283894311
|
||||
& -86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( -40019818573920230246248826511203818792007462193311949166285967147
|
||||
& -9487909752)
|
||||
|
51
tests/basics/int_big_and2.py
Normal file
51
tests/basics/int_big_and2.py
Normal file
@ -0,0 +1,51 @@
|
||||
# test + +
|
||||
|
||||
print( 97989513389222316022151446562729620153292831887555425160965597396
|
||||
& 23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( 53817081128841898634258263553430908085326601592682411889506742059
|
||||
& 37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( 26167512042587370698808974207700979337713004510730289760097826496
|
||||
& 98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( 21085380307304977067262070503651827226504797285572981274069266136
|
||||
& 15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( 40827393422334167255488276244226338235131323044408420081160772273
|
||||
& 63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( 5181013159871685724135944379095645225188360725917119022722046448
|
||||
& 59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( 283894311
|
||||
& 86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( 40019818573920230246248826511203818792007462193311949166285967147
|
||||
& 9487909752)
|
||||
|
||||
# test - -
|
||||
|
||||
print( -97989513389222316022151446562729620153292831887555425160965597396
|
||||
& -23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( -53817081128841898634258263553430908085326601592682411889506742059
|
||||
& -37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( -26167512042587370698808974207700979337713004510730289760097826496
|
||||
& -98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( -21085380307304977067262070503651827226504797285572981274069266136
|
||||
& -15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( -40827393422334167255488276244226338235131323044408420081160772273
|
||||
& -63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( -5181013159871685724135944379095645225188360725917119022722046448
|
||||
& -59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( -283894311
|
||||
& -86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( -40019818573920230246248826511203818792007462193311949166285967147
|
||||
& -9487909752)
|
51
tests/basics/int_big_and3.py
Normal file
51
tests/basics/int_big_and3.py
Normal file
@ -0,0 +1,51 @@
|
||||
# test - +
|
||||
|
||||
print( -97989513389222316022151446562729620153292831887555425160965597396
|
||||
& 23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( -53817081128841898634258263553430908085326601592682411889506742059
|
||||
& 37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( -26167512042587370698808974207700979337713004510730289760097826496
|
||||
& 98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( -21085380307304977067262070503651827226504797285572981274069266136
|
||||
& 15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( -40827393422334167255488276244226338235131323044408420081160772273
|
||||
& 63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( -5181013159871685724135944379095645225188360725917119022722046448
|
||||
& 59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( -283894311
|
||||
& 86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( -40019818573920230246248826511203818792007462193311949166285967147
|
||||
& 9487909752)
|
||||
|
||||
# test + -
|
||||
|
||||
print( 97989513389222316022151446562729620153292831887555425160965597396
|
||||
& -23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( 53817081128841898634258263553430908085326601592682411889506742059
|
||||
& -37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( 26167512042587370698808974207700979337713004510730289760097826496
|
||||
& -98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( 21085380307304977067262070503651827226504797285572981274069266136
|
||||
& -15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( 40827393422334167255488276244226338235131323044408420081160772273
|
||||
& -63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( 5181013159871685724135944379095645225188360725917119022722046448
|
||||
& -59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( 283894311
|
||||
& -86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( 40019818573920230246248826511203818792007462193311949166285967147
|
||||
& -9487909752)
|
@ -3,7 +3,6 @@ print(0 | (1 << 80))
|
||||
a = 0xfffffffffffffffffffffffffffff
|
||||
print(a | (1 << 200))
|
||||
|
||||
|
||||
# test + +
|
||||
|
||||
print(0 | (1 << 80))
|
||||
@ -16,30 +15,6 @@ print(a | (1 << 200))
|
||||
print(a | a == 0)
|
||||
print(bool(a | a))
|
||||
|
||||
print( 97989513389222316022151446562729620153292831887555425160965597396
|
||||
| 23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( 53817081128841898634258263553430908085326601592682411889506742059
|
||||
| 37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( 26167512042587370698808974207700979337713004510730289760097826496
|
||||
| 98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( 21085380307304977067262070503651827226504797285572981274069266136
|
||||
| 15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( 40827393422334167255488276244226338235131323044408420081160772273
|
||||
| 63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( 5181013159871685724135944379095645225188360725917119022722046448
|
||||
| 59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( 283894311
|
||||
| 86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( 40019818573920230246248826511203818792007462193311949166285967147
|
||||
| 9487909752)
|
||||
|
||||
# test - +
|
||||
|
||||
print((-1 << 80) | (1 << 80))
|
||||
@ -50,30 +25,6 @@ print((-a) | (1 << 200))
|
||||
print((-a) | a == 0)
|
||||
print(bool((-a) | a))
|
||||
|
||||
print( -97989513389222316022151446562729620153292831887555425160965597396
|
||||
| 23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( -53817081128841898634258263553430908085326601592682411889506742059
|
||||
| 37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( -26167512042587370698808974207700979337713004510730289760097826496
|
||||
| 98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( -21085380307304977067262070503651827226504797285572981274069266136
|
||||
| 15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( -40827393422334167255488276244226338235131323044408420081160772273
|
||||
| 63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( -5181013159871685724135944379095645225188360725917119022722046448
|
||||
| 59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( -283894311
|
||||
| 86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( -40019818573920230246248826511203818792007462193311949166285967147
|
||||
| 9487909752)
|
||||
|
||||
# test + -
|
||||
|
||||
print(0 | (-1 << 80))
|
||||
@ -84,30 +35,6 @@ print(a | (-1 << 200))
|
||||
print(a | (-a) == 0)
|
||||
print(bool(a | (-a)))
|
||||
|
||||
print( 97989513389222316022151446562729620153292831887555425160965597396
|
||||
| -23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( 53817081128841898634258263553430908085326601592682411889506742059
|
||||
| -37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( 26167512042587370698808974207700979337713004510730289760097826496
|
||||
| -98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( 21085380307304977067262070503651827226504797285572981274069266136
|
||||
| -15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( 40827393422334167255488276244226338235131323044408420081160772273
|
||||
| -63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( 5181013159871685724135944379095645225188360725917119022722046448
|
||||
| -59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( 283894311
|
||||
| -86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( 40019818573920230246248826511203818792007462193311949166285967147
|
||||
| -9487909752)
|
||||
|
||||
# test - -
|
||||
|
||||
print((-1 << 80) | (-1 << 80))
|
||||
@ -116,29 +43,3 @@ print((-a) | (-1 << 100))
|
||||
print((-a) | (-1 << 200))
|
||||
print((-a) | (-a) == 0)
|
||||
print(bool((-a) | (-a)))
|
||||
|
||||
print( -97989513389222316022151446562729620153292831887555425160965597396
|
||||
| -23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( -53817081128841898634258263553430908085326601592682411889506742059
|
||||
| -37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( -26167512042587370698808974207700979337713004510730289760097826496
|
||||
| -98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( -21085380307304977067262070503651827226504797285572981274069266136
|
||||
| -15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( -40827393422334167255488276244226338235131323044408420081160772273
|
||||
| -63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( -5181013159871685724135944379095645225188360725917119022722046448
|
||||
| -59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( -283894311
|
||||
| -86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( -40019818573920230246248826511203818792007462193311949166285967147
|
||||
| -9487909752)
|
||||
|
||||
|
||||
|
50
tests/basics/int_big_or2.py
Normal file
50
tests/basics/int_big_or2.py
Normal file
@ -0,0 +1,50 @@
|
||||
# test + +
|
||||
print( 97989513389222316022151446562729620153292831887555425160965597396
|
||||
| 23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( 53817081128841898634258263553430908085326601592682411889506742059
|
||||
| 37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( 26167512042587370698808974207700979337713004510730289760097826496
|
||||
| 98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( 21085380307304977067262070503651827226504797285572981274069266136
|
||||
| 15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( 40827393422334167255488276244226338235131323044408420081160772273
|
||||
| 63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( 5181013159871685724135944379095645225188360725917119022722046448
|
||||
| 59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( 283894311
|
||||
| 86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( 40019818573920230246248826511203818792007462193311949166285967147
|
||||
| 9487909752)
|
||||
|
||||
# test - -
|
||||
|
||||
print( -97989513389222316022151446562729620153292831887555425160965597396
|
||||
| -23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( -53817081128841898634258263553430908085326601592682411889506742059
|
||||
| -37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( -26167512042587370698808974207700979337713004510730289760097826496
|
||||
| -98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( -21085380307304977067262070503651827226504797285572981274069266136
|
||||
| -15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( -40827393422334167255488276244226338235131323044408420081160772273
|
||||
| -63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( -5181013159871685724135944379095645225188360725917119022722046448
|
||||
| -59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( -283894311
|
||||
| -86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( -40019818573920230246248826511203818792007462193311949166285967147
|
||||
| -9487909752)
|
51
tests/basics/int_big_or3.py
Normal file
51
tests/basics/int_big_or3.py
Normal file
@ -0,0 +1,51 @@
|
||||
# test - +
|
||||
|
||||
print( -97989513389222316022151446562729620153292831887555425160965597396
|
||||
| 23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( -53817081128841898634258263553430908085326601592682411889506742059
|
||||
| 37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( -26167512042587370698808974207700979337713004510730289760097826496
|
||||
| 98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( -21085380307304977067262070503651827226504797285572981274069266136
|
||||
| 15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( -40827393422334167255488276244226338235131323044408420081160772273
|
||||
| 63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( -5181013159871685724135944379095645225188360725917119022722046448
|
||||
| 59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( -283894311
|
||||
| 86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( -40019818573920230246248826511203818792007462193311949166285967147
|
||||
| 9487909752)
|
||||
|
||||
# test + -
|
||||
|
||||
print( 97989513389222316022151446562729620153292831887555425160965597396
|
||||
| -23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( 53817081128841898634258263553430908085326601592682411889506742059
|
||||
| -37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( 26167512042587370698808974207700979337713004510730289760097826496
|
||||
| -98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( 21085380307304977067262070503651827226504797285572981274069266136
|
||||
| -15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( 40827393422334167255488276244226338235131323044408420081160772273
|
||||
| -63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( 5181013159871685724135944379095645225188360725917119022722046448
|
||||
| -59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( 283894311
|
||||
| -86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( 40019818573920230246248826511203818792007462193311949166285967147
|
||||
| -9487909752)
|
@ -1,4 +1,3 @@
|
||||
|
||||
# test + +
|
||||
|
||||
print(0 ^ (1 << 80))
|
||||
@ -11,30 +10,6 @@ print(a ^ (1 << 200))
|
||||
print(a ^ a == 0)
|
||||
print(bool(a ^ a))
|
||||
|
||||
print( 97989513389222316022151446562729620153292831887555425160965597396
|
||||
^ 23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( 53817081128841898634258263553430908085326601592682411889506742059
|
||||
^ 37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( 26167512042587370698808974207700979337713004510730289760097826496
|
||||
^ 98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( 21085380307304977067262070503651827226504797285572981274069266136
|
||||
^ 15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( 40827393422334167255488276244226338235131323044408420081160772273
|
||||
^ 63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( 5181013159871685724135944379095645225188360725917119022722046448
|
||||
^ 59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( 283894311
|
||||
^ 86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( 40019818573920230246248826511203818792007462193311949166285967147
|
||||
^ 9487909752)
|
||||
|
||||
# test - +
|
||||
|
||||
print((-1 << 80) ^ (1 << 80))
|
||||
@ -45,30 +20,6 @@ print((-a) ^ (1 << 200))
|
||||
print((-a) ^ a == 0)
|
||||
print(bool((-a) ^ a))
|
||||
|
||||
print( -97989513389222316022151446562729620153292831887555425160965597396
|
||||
^ 23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( -53817081128841898634258263553430908085326601592682411889506742059
|
||||
^ 37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( -26167512042587370698808974207700979337713004510730289760097826496
|
||||
^ 98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( -21085380307304977067262070503651827226504797285572981274069266136
|
||||
^ 15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( -40827393422334167255488276244226338235131323044408420081160772273
|
||||
^ 63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( -5181013159871685724135944379095645225188360725917119022722046448
|
||||
^ 59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( -283894311
|
||||
^ 86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( -40019818573920230246248826511203818792007462193311949166285967147
|
||||
^ 9487909752)
|
||||
|
||||
# test + -
|
||||
|
||||
print(0 ^ (-1 << 80))
|
||||
@ -79,30 +30,6 @@ print(a ^ (-1 << 200))
|
||||
print(a ^ (-a) == 0)
|
||||
print(bool(a ^ (-a)))
|
||||
|
||||
print( 97989513389222316022151446562729620153292831887555425160965597396
|
||||
^ -23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( 53817081128841898634258263553430908085326601592682411889506742059
|
||||
^ -37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( 26167512042587370698808974207700979337713004510730289760097826496
|
||||
^ -98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( 21085380307304977067262070503651827226504797285572981274069266136
|
||||
^ -15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( 40827393422334167255488276244226338235131323044408420081160772273
|
||||
^ -63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( 5181013159871685724135944379095645225188360725917119022722046448
|
||||
^ -59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( 283894311
|
||||
^ -86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( 40019818573920230246248826511203818792007462193311949166285967147
|
||||
^ -9487909752)
|
||||
|
||||
# test - -
|
||||
|
||||
print((-1 << 80) ^ (-1 << 80))
|
||||
@ -111,28 +38,3 @@ print((-a) ^ (-1 << 100))
|
||||
print((-a) ^ (-1 << 200))
|
||||
print((-a) ^ (-a) == 0)
|
||||
print(bool((-a) ^ (-a)))
|
||||
|
||||
print( -97989513389222316022151446562729620153292831887555425160965597396
|
||||
^ -23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( -53817081128841898634258263553430908085326601592682411889506742059
|
||||
^ -37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( -26167512042587370698808974207700979337713004510730289760097826496
|
||||
^ -98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( -21085380307304977067262070503651827226504797285572981274069266136
|
||||
^ -15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( -40827393422334167255488276244226338235131323044408420081160772273
|
||||
^ -63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( -5181013159871685724135944379095645225188360725917119022722046448
|
||||
^ -59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( -283894311
|
||||
^ -86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( -40019818573920230246248826511203818792007462193311949166285967147
|
||||
^ -9487909752)
|
||||
|
||||
|
51
tests/basics/int_big_xor2.py
Normal file
51
tests/basics/int_big_xor2.py
Normal file
@ -0,0 +1,51 @@
|
||||
# test + +
|
||||
|
||||
print( 97989513389222316022151446562729620153292831887555425160965597396
|
||||
^ 23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( 53817081128841898634258263553430908085326601592682411889506742059
|
||||
^ 37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( 26167512042587370698808974207700979337713004510730289760097826496
|
||||
^ 98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( 21085380307304977067262070503651827226504797285572981274069266136
|
||||
^ 15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( 40827393422334167255488276244226338235131323044408420081160772273
|
||||
^ 63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( 5181013159871685724135944379095645225188360725917119022722046448
|
||||
^ 59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( 283894311
|
||||
^ 86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( 40019818573920230246248826511203818792007462193311949166285967147
|
||||
^ 9487909752)
|
||||
|
||||
# test - -
|
||||
|
||||
print( -97989513389222316022151446562729620153292831887555425160965597396
|
||||
^ -23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( -53817081128841898634258263553430908085326601592682411889506742059
|
||||
^ -37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( -26167512042587370698808974207700979337713004510730289760097826496
|
||||
^ -98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( -21085380307304977067262070503651827226504797285572981274069266136
|
||||
^ -15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( -40827393422334167255488276244226338235131323044408420081160772273
|
||||
^ -63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( -5181013159871685724135944379095645225188360725917119022722046448
|
||||
^ -59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( -283894311
|
||||
^ -86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( -40019818573920230246248826511203818792007462193311949166285967147
|
||||
^ -9487909752)
|
51
tests/basics/int_big_xor3.py
Normal file
51
tests/basics/int_big_xor3.py
Normal file
@ -0,0 +1,51 @@
|
||||
# test - +
|
||||
|
||||
print( -97989513389222316022151446562729620153292831887555425160965597396
|
||||
^ 23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( -53817081128841898634258263553430908085326601592682411889506742059
|
||||
^ 37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( -26167512042587370698808974207700979337713004510730289760097826496
|
||||
^ 98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( -21085380307304977067262070503651827226504797285572981274069266136
|
||||
^ 15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( -40827393422334167255488276244226338235131323044408420081160772273
|
||||
^ 63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( -5181013159871685724135944379095645225188360725917119022722046448
|
||||
^ 59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( -283894311
|
||||
^ 86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( -40019818573920230246248826511203818792007462193311949166285967147
|
||||
^ 9487909752)
|
||||
|
||||
# test + -
|
||||
|
||||
print( 97989513389222316022151446562729620153292831887555425160965597396
|
||||
^ -23716683549865351578586448630079789776107310103486834795830390982)
|
||||
|
||||
print( 53817081128841898634258263553430908085326601592682411889506742059
|
||||
^ -37042558948907407488299113387826240429667200950043601129661240876)
|
||||
|
||||
print( 26167512042587370698808974207700979337713004510730289760097826496
|
||||
^ -98456276326770292376138852628141531773120376436197321310863125849)
|
||||
|
||||
print( 21085380307304977067262070503651827226504797285572981274069266136
|
||||
^ -15928222825828272388778130358888206480162413547887287646273147570)
|
||||
|
||||
print( 40827393422334167255488276244226338235131323044408420081160772273
|
||||
^ -63815443187857978125545555033672525708399848575557475462799643340)
|
||||
|
||||
print( 5181013159871685724135944379095645225188360725917119022722046448
|
||||
^ -59734090450462480092384049604830976376887859531148103803093112493)
|
||||
|
||||
print( 283894311
|
||||
^ -86526825689187217371383854139783231460931720533100376593106943447)
|
||||
|
||||
print( 40019818573920230246248826511203818792007462193311949166285967147
|
||||
^ -9487909752)
|
@ -1,7 +1,4 @@
|
||||
# Change the following to True to get a much more comprehensive set of tests
|
||||
# to run, albeit, which take considerably longer.
|
||||
|
||||
full_tests = False
|
||||
# basic functionality test for {} format string
|
||||
|
||||
def test(fmt, *args):
|
||||
print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<')
|
||||
@ -77,151 +74,3 @@ print("{text:{align}{width}}".format(text="foo", align=">", width=30))
|
||||
print("{foo}/foo".format(foo="bar"))
|
||||
print("{}".format(123, foo="bar"))
|
||||
print("{}-{foo}".format(123, foo="bar"))
|
||||
|
||||
def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg):
|
||||
fmt = '{'
|
||||
if conv:
|
||||
fmt += '!'
|
||||
fmt += conv
|
||||
fmt += ':'
|
||||
if alignment:
|
||||
fmt += fill
|
||||
fmt += alignment
|
||||
fmt += sign
|
||||
fmt += prefix
|
||||
fmt += width
|
||||
if precision:
|
||||
fmt += '.'
|
||||
fmt += precision
|
||||
fmt += type
|
||||
fmt += '}'
|
||||
test(fmt, arg)
|
||||
if fill == '0' and alignment == '=':
|
||||
fmt = '{:'
|
||||
fmt += sign
|
||||
fmt += prefix
|
||||
fmt += width
|
||||
if precision:
|
||||
fmt += '.'
|
||||
fmt += precision
|
||||
fmt += type
|
||||
fmt += '}'
|
||||
test(fmt, arg)
|
||||
|
||||
int_nums = (-1234, -123, -12, -1, 0, 1, 12, 123, 1234, True, False)
|
||||
int_nums2 = (-12, -1, 0, 1, 12, True, False)
|
||||
|
||||
if full_tests:
|
||||
for type in ('', 'b', 'd', 'o', 'x', 'X'):
|
||||
for width in ('', '1', '3', '5', '7'):
|
||||
for alignment in ('', '<', '>', '=', '^'):
|
||||
for fill in ('', ' ', '0', '@'):
|
||||
for sign in ('', '+', '-', ' '):
|
||||
for prefix in ('', '#'):
|
||||
for num in int_nums:
|
||||
test_fmt('', fill, alignment, sign, prefix, width, '', type, num)
|
||||
|
||||
if full_tests:
|
||||
for width in ('', '1', '2'):
|
||||
for alignment in ('', '<', '>', '^'):
|
||||
for fill in ('', ' ', '0', '@'):
|
||||
test_fmt('', fill, alignment, '', '', width, '', 'c', 48)
|
||||
|
||||
if full_tests:
|
||||
for conv in ('', 'r', 's'):
|
||||
for width in ('', '1', '4', '10'):
|
||||
for alignment in ('', '<', '>', '^'):
|
||||
for fill in ('', ' ', '0', '@'):
|
||||
for str in ('', 'a', 'bcd', 'This is a test with a longer string'):
|
||||
test_fmt(conv, fill, alignment, '', '', width, '', 's', str)
|
||||
|
||||
# tests for errors in format string
|
||||
|
||||
try:
|
||||
'{0:0}'.format('zzz')
|
||||
except (ValueError):
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{1:}'.format(1)
|
||||
except IndexError:
|
||||
print('IndexError')
|
||||
|
||||
try:
|
||||
'}'.format('zzzz')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
# end of format parsing conversion specifier
|
||||
try:
|
||||
'{!'.format('a')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
# unknown conversion specifier
|
||||
try:
|
||||
'abc{!d}'.format('1')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{abc'.format('zzzz')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
# expected ':' after specifier
|
||||
try:
|
||||
'{!s :}'.format(2)
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{}{0}'.format(1, 2)
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{1:}'.format(1)
|
||||
except IndexError:
|
||||
print('IndexError')
|
||||
|
||||
try:
|
||||
'{ 0 :*^10}'.format(12)
|
||||
except KeyError:
|
||||
print('KeyError')
|
||||
|
||||
try:
|
||||
'{0}{}'.format(1)
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{}{}'.format(1)
|
||||
except IndexError:
|
||||
print('IndexError')
|
||||
|
||||
try:
|
||||
'{0:+s}'.format('1')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{0:+c}'.format(1)
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{0:s}'.format(1)
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{:*"1"}'.format('zz')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
# unknown format code for str arg
|
||||
try:
|
||||
'{:X}'.format('zz')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
64
tests/basics/string_format2.py
Normal file
64
tests/basics/string_format2.py
Normal file
@ -0,0 +1,64 @@
|
||||
# comprehensive functionality test for {} format string
|
||||
|
||||
int_tests = False # these take a while, and some give wrong results
|
||||
char_tests = True
|
||||
str_tests = True
|
||||
|
||||
def test(fmt, *args):
|
||||
print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<')
|
||||
|
||||
def test_fmt(conv, fill, alignment, sign, prefix, width, precision, type, arg):
|
||||
fmt = '{'
|
||||
if conv:
|
||||
fmt += '!'
|
||||
fmt += conv
|
||||
fmt += ':'
|
||||
if alignment:
|
||||
fmt += fill
|
||||
fmt += alignment
|
||||
fmt += sign
|
||||
fmt += prefix
|
||||
fmt += width
|
||||
if precision:
|
||||
fmt += '.'
|
||||
fmt += precision
|
||||
fmt += type
|
||||
fmt += '}'
|
||||
test(fmt, arg)
|
||||
if fill == '0' and alignment == '=':
|
||||
fmt = '{:'
|
||||
fmt += sign
|
||||
fmt += prefix
|
||||
fmt += width
|
||||
if precision:
|
||||
fmt += '.'
|
||||
fmt += precision
|
||||
fmt += type
|
||||
fmt += '}'
|
||||
test(fmt, arg)
|
||||
|
||||
if int_tests:
|
||||
int_nums = (-1234, -123, -12, -1, 0, 1, 12, 123, 1234, True, False)
|
||||
#int_nums = (-12, -1, 0, 1, 12, True, False)
|
||||
for type in ('', 'b', 'd', 'o', 'x', 'X'):
|
||||
for width in ('', '1', '3', '5', '7'):
|
||||
for alignment in ('', '<', '>', '=', '^'):
|
||||
for fill in ('', ' ', '0', '@'):
|
||||
for sign in ('', '+', '-', ' '):
|
||||
for prefix in ('', '#'):
|
||||
for num in int_nums:
|
||||
test_fmt('', fill, alignment, sign, prefix, width, '', type, num)
|
||||
|
||||
if char_tests:
|
||||
for width in ('', '1', '2'):
|
||||
for alignment in ('', '<', '>', '^'):
|
||||
for fill in ('', ' ', '0', '@'):
|
||||
test_fmt('', fill, alignment, '', '', width, '', 'c', 48)
|
||||
|
||||
if str_tests:
|
||||
for conv in ('', 'r', 's'):
|
||||
for width in ('', '1', '4', '10'):
|
||||
for alignment in ('', '<', '>', '^'):
|
||||
for fill in ('', ' ', '0', '@'):
|
||||
for str in ('', 'a', 'bcd', 'This is a test with a longer string'):
|
||||
test_fmt(conv, fill, alignment, '', '', width, '', 's', str)
|
90
tests/basics/string_format_error.py
Normal file
90
tests/basics/string_format_error.py
Normal file
@ -0,0 +1,90 @@
|
||||
# tests for errors in {} format string
|
||||
|
||||
try:
|
||||
'{0:0}'.format('zzz')
|
||||
except (ValueError):
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{1:}'.format(1)
|
||||
except IndexError:
|
||||
print('IndexError')
|
||||
|
||||
try:
|
||||
'}'.format('zzzz')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
# end of format parsing conversion specifier
|
||||
try:
|
||||
'{!'.format('a')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
# unknown conversion specifier
|
||||
try:
|
||||
'abc{!d}'.format('1')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{abc'.format('zzzz')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
# expected ':' after specifier
|
||||
try:
|
||||
'{!s :}'.format(2)
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{}{0}'.format(1, 2)
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{1:}'.format(1)
|
||||
except IndexError:
|
||||
print('IndexError')
|
||||
|
||||
try:
|
||||
'{ 0 :*^10}'.format(12)
|
||||
except KeyError:
|
||||
print('KeyError')
|
||||
|
||||
try:
|
||||
'{0}{}'.format(1)
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{}{}'.format(1)
|
||||
except IndexError:
|
||||
print('IndexError')
|
||||
|
||||
try:
|
||||
'{0:+s}'.format('1')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{0:+c}'.format(1)
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{0:s}'.format(1)
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
try:
|
||||
'{:*"1"}'.format('zz')
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
# unknown format code for str arg
|
||||
try:
|
||||
'{:X}'.format('zz')
|
||||
except ValueError:
|
||||
print('ValueError')
|
Loading…
Reference in New Issue
Block a user