Skip to content

Commit 4197ccb

Browse files
committed
Fix repr of optional string
1 parent 632477c commit 4197ccb

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

codegen/table.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,6 @@ impl<'a> TableBindGenerator<'a> {
627627
.fields
628628
.iter()
629629
.map(|(field_name, field_info)| match &field_info.type_.kind {
630-
TypeKind::String => format!("{field_name}={{:?}}"),
631630
TypeKind::Vector(inner_type) => match inner_type.kind {
632631
TypeKind::SimpleType(SimpleType::Integer(IntegerType::U8)) => {
633632
format!("{field_name}=bytes([{{}}])")
@@ -694,7 +693,7 @@ impl<'a> TableBindGenerator<'a> {
694693
_ => {
695694
write_fmt!(
696695
self,
697-
" self.{field_name}.bind(py).to_cow().unwrap(),"
696+
" format!(\"{{:?}}\", self.{field_name}.bind(py).to_cow().unwrap()),"
698697
);
699698
}
700699
},

pytest.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,8 @@ def random_script_config():
6161

6262
dgs = DesiredGameState(match_info=DesiredMatchInfo(game_speed=2))
6363

64-
match dgs.match_info:
65-
case DesiredMatchInfo():
66-
dgs.match_info.world_gravity_z = -650
67-
case _:
68-
assert False
64+
assert dgs.match_info is not None
65+
dgs.match_info.world_gravity_z = -650
6966

7067
assert dgs.match_info.game_speed is not None
7168
dgs.match_info.game_speed += 1

0 commit comments

Comments
 (0)