@@ -382,22 +382,22 @@ def test_const(self):
382382 "a" : unsigned (1 ),
383383 "b" : unsigned (2 )
384384 })
385- self .assertRepr (sl .const (None ), "(const 3'd0)" )
386- self .assertRepr (sl .const ({"a" : 0b1 , "b" : 0b10 }), "(const 3'd5)" )
385+ self .assertRepr (sl .const (None ). as_value () , "(const 3'd0)" )
386+ self .assertRepr (sl .const ({"a" : 0b1 , "b" : 0b10 }). as_value () , "(const 3'd5)" )
387387
388388 fl = FlexibleLayout (2 , {
389389 "a" : Field (unsigned (1 ), 0 ),
390390 "b" : Field (unsigned (2 ), 0 )
391391 })
392- self .assertRepr (fl .const ({"a" : 0b11 }), "(const 2'd1)" )
393- self .assertRepr (fl .const ({"b" : 0b10 }), "(const 2'd2)" )
394- self .assertRepr (fl .const ({"a" : 0b1 , "b" : 0b10 }), "(const 2'd2)" )
392+ self .assertRepr (fl .const ({"a" : 0b11 }). as_value () , "(const 2'd1)" )
393+ self .assertRepr (fl .const ({"b" : 0b10 }). as_value () , "(const 2'd2)" )
394+ self .assertRepr (fl .const ({"a" : 0b1 , "b" : 0b10 }). as_value () , "(const 2'd2)" )
395395
396396 sls = StructLayout ({
397397 "a" : signed (4 ),
398398 "b" : signed (4 )
399399 })
400- self .assertRepr (sls .const ({"b" : 0 , "a" : - 1 }), "(const 8'd15)" )
400+ self .assertRepr (sls .const ({"b" : 0 , "a" : - 1 }). as_value () , "(const 8'd15)" )
401401
402402 def test_const_wrong (self ):
403403 sl = StructLayout ({"f" : unsigned (1 )})
@@ -418,7 +418,7 @@ def const(self, init):
418418 return int (init , 16 )
419419
420420 sl = StructLayout ({"f" : CastableFromHex ()})
421- self .assertRepr (sl .const ({"f" : "aa" }), "(const 8'd170)" )
421+ self .assertRepr (sl .const ({"f" : "aa" }). as_value () , "(const 8'd170)" )
422422
423423 with self .assertRaisesRegex (ValueError ,
424424 r"^Constant returned by <.+?CastableFromHex.+?>\.const\(\) must have the shape "
@@ -427,7 +427,7 @@ def const(self, init):
427427
428428 def test_const_field_const (self ):
429429 sl = StructLayout ({"f" : unsigned (1 )})
430- self .assertRepr (sl .const ({"f" : Const (1 )}), "(const 1'd1)" )
430+ self .assertRepr (sl .const ({"f" : Const (1 )}). as_value () , "(const 1'd1)" )
431431
432432 def test_signal_reset (self ):
433433 sl = StructLayout ({
0 commit comments