Skip to content

Commit d9ff739

Browse files
authored
Revert v1 namespace (#10)
* Revert "update readme" This reverts commit 454df21. * Revert "update readme" This reverts commit a28d949. * Revert "feat: add v1 namespace (#8)" This reverts commit 33b2662. * redo field stuff * undo change
1 parent 89dd343 commit d9ff739

File tree

4 files changed

+7
-33
lines changed

4 files changed

+7
-33
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,18 @@ pydantic version installed (without deprecation warnings):
101101
| `Model.__fields__` | `Model.model_fields` |
102102
| `Model.__fields_set__` | `Model.model_fields_set` |
103103

104+
104105
## `Field` notes
105106

106107
- `pydantic_compat.Field` will remove outdated fields (`const`) and translate
107108
fields with new names:
108-
| v1 name | v2 name |
109+
| v1 name | v2 name |
109110
| ---------------- | ------------------- |
110-
| `min_items` | `min_length` |
111-
| `max_items` | `max_length` |
112-
| `regex` | `pattern` |
113-
| `allow_mutation` | `not frozen` |
114-
| `metadata` | `json_schema_extra` |
111+
| `min_items` | `min_length` |
112+
| `max_items` | `max_length` |
113+
| `regex` | `pattern` |
114+
| `allow_mutation` | `not frozen` |
115+
| `metadata` | `json_schema_extra` |
115116
- Don't use `var = Field(..., const='val')`, use `var: Literal['val'] = 'val'`
116117
it works in both v1 and v2
117118
- No attempt is made to convert between v1's `unique_items` and v2's `Set[]`

src/pydantic_compat/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"BaseModel",
2727
]
2828

29-
3029
from ._shared import PYDANTIC2
3130

3231
if TYPE_CHECKING:

src/pydantic_compat/v1.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/test_base_model.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,3 @@ class Model(PydanticCompatMixin, pydantic.BaseModel):
118118
# test extra
119119
with pytest.raises((ValueError, TypeError)): # (v1, v2)
120120
Model(extra=1)
121-
122-
123-
def test_v1_namespace() -> None:
124-
from pydantic_compat.v1 import BaseModel
125-
126-
class Model(BaseModel):
127-
x: int = 1
128-
129-
m = Model()
130-
assert m.dict() == {"x": 1} # no warning

0 commit comments

Comments
 (0)