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

Method from_file

Lib/test/test_dataclasses/__init__.py:2042–2046  ·  view source on GitHub ↗
(cls, filename)

Source from the content-addressed store, hash-verified

2040 x: int
2041 @classmethod
2042 def from_file(cls, filename):
2043 # In a real example, create a new instance
2044 # and populate 'x' from contents of a file.
2045 value_in_file = 20
2046 return cls(value_in_file)
2047
2048 self.assertEqual(C.from_file('filename').x, 20)
2049

Callers 15

test_from_fileMethod · 0.45
test_from_file_bytesMethod · 0.45
test_from_file_filenoMethod · 0.45
test_from_dirMethod · 0.45
test_strMethod · 0.45
test_reprMethod · 0.45
from_file_nokeyMethod · 0.45
test_bad_zonesMethod · 0.45
test_one_transitionMethod · 0.45
test_one_zone_dstMethod · 0.45

Calls 1

clsClass · 0.50

Tested by 15

test_from_fileMethod · 0.36
test_from_file_bytesMethod · 0.36
test_from_file_filenoMethod · 0.36
test_from_dirMethod · 0.36
test_strMethod · 0.36
test_reprMethod · 0.36
from_file_nokeyMethod · 0.36
test_bad_zonesMethod · 0.36
test_one_transitionMethod · 0.36
test_one_zone_dstMethod · 0.36