File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6666print (">%-+08.4d<" % - 12 )
6767print (">%-+08.4d<" % 12 )
6868
69+ # Should be able to print dicts; in this case they aren't used
70+ # to lookup keywords in formats like %(foo)s
71+ print ('%s' % {})
72+ print ('%s' % ({},))
73+
6974# Cases when "*" used and there's not enough values total
7075try :
7176 print ("%*s" % 5 )
7782 print ("TypeError" )
7883
7984print ("%(foo)s" % {"foo" : "bar" , "baz" : False })
85+ print ("%s %(foo)s %(foo)s" % {"foo" : 1 })
8086try :
8187 print ("%(foo)s" % {})
8288except KeyError :
8793except TypeError :
8894 print ("TypeError" )
8995
96+ # When using %(foo)s format the single argument must be a dict
97+ try :
98+ '%(foo)s' % 1
99+ except TypeError :
100+ print ('TypeError' )
101+ try :
102+ '%(foo)s' % ({},)
103+ except TypeError :
104+ print ('TypeError' )
105+
90106try :
91107 '%(a' % {'a' :1 }
92108except ValueError :
You can’t perform that action at this time.
0 commit comments