@@ -44,6 +44,27 @@ def test_zero_wear_float_format(self):
4444 code = to_gen_code (item )
4545 assert code == "!gen 7 474 306 0"
4646
47+ def test_keychain_with_paint_kit_appends_paint_kit (self ):
48+ item = ItemPreviewData (
49+ defindex = 1355 , paintindex = 0 , paintseed = 0 , paintwear = 0.0 ,
50+ keychains = [Sticker (slot = 0 , sticker_id = 37 , wear = 0.0 , paint_kit = 929 )],
51+ )
52+ code = to_gen_code (item , prefix = "" )
53+ tokens = code .split ()
54+ assert tokens [- 3 ] == "37"
55+ assert tokens [- 2 ] == "0"
56+ assert tokens [- 1 ] == "929"
57+
58+ def test_keychain_without_paint_kit_no_extra_token (self ):
59+ item = ItemPreviewData (
60+ defindex = 7 , paintindex = 0 , paintseed = 0 , paintwear = 0.0 ,
61+ keychains = [Sticker (slot = 0 , sticker_id = 36 , wear = 0.0 )],
62+ )
63+ code = to_gen_code (item , prefix = "" )
64+ tokens = code .split ()
65+ assert tokens [- 2 ] == "36"
66+ assert tokens [- 1 ] == "0"
67+
4768
4869class TestParseGenCode :
4970 def test_basic_parse (self ):
@@ -71,6 +92,17 @@ def test_parse_with_sticker_and_keychain(self):
7192 assert item .keychains [0 ].sticker_id == 36
7293
7394
95+ class TestGenCodeFromLinkSlab :
96+ def test_mousesports_slab_url_ends_with_paint_kit (self ):
97+ from cs2_inspect import gen_code_from_link
98+ slab_url = "steam://run/730//+csgo_econ_action_preview%20819181994A8BA181A982B189E981F181238086898191A4E1208698F309C9"
99+ code = gen_code_from_link (slab_url , prefix = "" )
100+ tokens = code .split ()
101+ assert tokens [- 3 ] == "37"
102+ assert tokens [- 2 ] == "0"
103+ assert tokens [- 1 ] == "929"
104+
105+
74106class TestGenCodeFromLink :
75107 def test_from_hex (self ):
76108 from cs2_inspect import generate , gen_code_from_link
0 commit comments