MCPcopy Create free account
hub / github.com/apache/arrow / check_options_class

Function check_options_class

python/pyarrow/tests/test_csv.py:93–113  ·  view source on GitHub ↗

Check setting and getting attributes of an *Options class.

(cls, **attr_values)

Source from the content-addressed store, hash-verified

91
92
93def check_options_class(cls, **attr_values):
94 """
95 Check setting and getting attributes of an *Options class.
96 """
97 opts = cls()
98
99 for name, values in attr_values.items():
100 assert getattr(opts, name) == values[0], \
101 "incorrect default value for " + name
102 for v in values:
103 setattr(opts, name, v)
104 assert getattr(opts, name) == v, "failed setting value"
105
106 with pytest.raises(AttributeError):
107 opts.zzz_non_existent = True
108
109 # Check constructor named arguments
110 non_defaults = {name: values[1] for name, values in attr_values.items()}
111 opts = cls(**non_defaults)
112 for name, value in non_defaults.items():
113 assert getattr(opts, name) == value
114
115
116# The various options classes need to be picklable for dataset

Callers 4

test_read_optionsFunction · 0.85
test_parse_optionsFunction · 0.85
test_convert_optionsFunction · 0.85
test_write_optionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected