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

Class G

Lib/test/test_str.py:1130–1138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1128
1129 # class with __format__ that forwards to string, for some format_spec's
1130 class G:
1131 def __init__(self, x):
1132 self.x = x
1133 def __str__(self):
1134 return "string is " + self.x
1135 def __format__(self, format_spec):
1136 if format_spec == 'd':
1137 return 'G(' + self.x + ')'
1138 return object.__format__(self, format_spec)
1139
1140 class I(datetime.date):
1141 def __format__(self, format_spec):

Callers 1

test_formatMethod · 0.70

Calls

no outgoing calls

Tested by 1

test_formatMethod · 0.56