Commit 8e4560a9 authored by Eric V. Smith's avatar Eric V. Smith Committed by GitHub

Add 'Field' to dataclasses.__all__. (GH-6182)

- Add missing 'Field' to __all__.
- Improve tests to catch this.
parent dec1c778
......@@ -5,6 +5,7 @@ import inspect
__all__ = ['dataclass',
'field',
'Field',
'FrozenInstanceError',
'InitVar',
'MISSING',
......@@ -513,7 +514,7 @@ def _get_field(cls, a_name, a_type):
# and InitVars are also returned, but marked as such (see
# f._field_type).
# If the default value isn't derived from field, then it's
# If the default value isn't derived from Field, then it's
# only a normal default value. Convert it to a Field().
default = getattr(cls, a_name, MISSING)
if isinstance(default, Field):
......
from dataclasses import (
dataclass, field, FrozenInstanceError, fields, asdict, astuple,
make_dataclass, replace, InitVar, Field, MISSING, is_dataclass,
)
# Deliberately use "from dataclasses import *". Every name in __all__
# is tested, so they all must be present. This is a way to catch
# missing ones.
from dataclasses import *
import pickle
import inspect
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment