Skip to content

Commit 287c0e4

Browse files
committed
Better enum docstrings
1 parent 1718630 commit 287c0e4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

codegen/pyi.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,11 @@ pub fn generator(type_data: &Declarations) -> io::Result<()> {
7474
match &item.kind {
7575
DeclarationKind::Enum(info) => {
7676
for (var_val, var_info) in &info.variants {
77-
write_fmt!(file, " {}: {type_name}", normalize_caps(&var_info.name));
77+
let field_name = normalize_caps(&var_info.name);
78+
write_fmt!(file, " {field_name}: {type_name}");
7879

7980
write_str!(file, " \"\"\"");
80-
write_fmt!(file, " self.value = {var_val}");
81+
write_fmt!(file, " `assert int({type_name}.{field_name}) == {var_val}`");
8182

8283
if !var_info.docstrings.docstrings.is_empty() {
8384
write_str!(file, "");

0 commit comments

Comments
 (0)