diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index faad81bb..e0ed14c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,4 +63,4 @@ jobs: pip install pytest maturin patchelf maturin develop - pytest \ No newline at end of file + python3 tests/signature_tests.py \ No newline at end of file diff --git a/src/python/test_perf.py b/src/python/test_perf.py deleted file mode 100644 index 7b2596a1..00000000 --- a/src/python/test_perf.py +++ /dev/null @@ -1,14 +0,0 @@ -from demoparser2 import DemoParser -import time - -parser = DemoParser("test.dem") - -before = time.time() -for _ in range(10): - event_df = parser.parse_event("player_death", player=["X", "Y"], other=["total_rounds_played"]) -print("events took:", time.time() - before) - -before = time.time() -for _ in range(10): - ticks_df = parser.parse_ticks(["X", "Y"]) -print("ticks took:",time.time() - before) diff --git a/src/python/tests/signature_tests.py b/src/python/tests/signature_tests.py index 888b93e1..0b6b7762 100644 --- a/src/python/tests/signature_tests.py +++ b/src/python/tests/signature_tests.py @@ -4,10 +4,11 @@ import pandas as pd from demoparser2 import DemoParser +demo_path = "../parser/test_demo.dem" class SignatureTest(TestCase): def test_parse_header_signature(self): - parser = DemoParser("tests/data/test.dem") + parser = DemoParser(demo_path) header = parser.parse_header() self.assertIsInstance(header, dict) for key, value in header.items(): @@ -15,7 +16,7 @@ def test_parse_header_signature(self): self.assertIsInstance(value, str) def test_parse_convars_signature(self): - parser = DemoParser("tests/data/test.dem") + parser = DemoParser(demo_path) convars = parser.parse_convars() self.assertIsInstance(convars, dict) for key, value in convars.items(): @@ -23,39 +24,39 @@ def test_parse_convars_signature(self): self.assertIsInstance(value, str) def test_list_game_events_signature(self): - parser = DemoParser("tests/data/test.dem") + parser = DemoParser(demo_path) game_events = parser.list_game_events() self.assertIsInstance(game_events, list) for event in game_events: self.assertIsInstance(event, str) def test_parse_grenades_signature(self): - parser = DemoParser("tests/data/test.dem") + parser = DemoParser(demo_path) grenades = parser.parse_grenades() self.assertIsInstance(grenades, pd.DataFrame) def test_parse_chat_messages_signature(self): - parser = DemoParser("tests/data/test.dem") + parser = DemoParser(demo_path) chat_messages = parser.parse_chat_messages() self.assertIsInstance(chat_messages, pd.DataFrame) def test_parse_player_info_signature(self): - parser = DemoParser("tests/data/test.dem") + parser = DemoParser(demo_path) player_info = parser.parse_player_info() self.assertIsInstance(player_info, pd.DataFrame) def test_parse_item_drops_signature(self): - parser = DemoParser("tests/data/test.dem") + parser = DemoParser(demo_path) item_drops = parser.parse_item_drops() self.assertIsInstance(item_drops, pd.DataFrame) def test_parse_skins_signature(self): - parser = DemoParser("tests/data/test.dem") + parser = DemoParser(demo_path) skins = parser.parse_skins() self.assertIsInstance(skins, pd.DataFrame) def test_parse_event_signature(self): - parser = DemoParser("tests/data/test.dem") + parser = DemoParser(demo_path) event = parser.parse_event("player_death") self.assertIsInstance(event, pd.DataFrame) @@ -86,7 +87,7 @@ def test_parse_event_signature(self): parser.parse_event(5) def test_parse_events_signature(self): - parser = DemoParser("tests/data/test.dem") + parser = DemoParser(demo_path) events = parser.parse_events(["player_death"]) self.assertIsInstance(events, list) @@ -124,7 +125,7 @@ def test_parse_events_signature(self): parser.parse_events(5) def test_parse_voice_signature(self): - parser = DemoParser("tests/data/test.dem") + parser = DemoParser(demo_path) voice = parser.parse_voice() self.assertIsInstance(voice, dict) for key, value in voice.items(): @@ -132,7 +133,7 @@ def test_parse_voice_signature(self): self.assertIsInstance(value, bytes) def test_parse_ticks_signature(self): - parser = DemoParser("tests/data/test.dem") + parser = DemoParser(demo_path) ticks = parser.parse_ticks(["X", "Y"]) self.assertIsInstance(ticks, pd.DataFrame) diff --git a/src/wasm/src/lib.rs b/src/wasm/src/lib.rs index d6c3286b..57d312a2 100644 --- a/src/wasm/src/lib.rs +++ b/src/wasm/src/lib.rs @@ -215,13 +215,8 @@ pub fn parseTicks( Ok(output) => output, Err(e) => return Err(JsError::new(&format!("{}", e))), }; - real_names.push("tick".to_owned()); - real_names.push("steamid".to_owned()); - real_names.push("name".to_owned()); - let mut prop_infos = output.prop_controller.prop_infos.clone(); prop_infos.sort_by_key(|x| x.prop_name.clone()); - real_names.sort(); let helper = OutputSerdeHelperStruct { prop_infos: prop_infos,