File tree 3 files changed +8
-4
lines changed
3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -66,5 +66,9 @@ class NPKIdError(BaseException):
66
66
pass
67
67
68
68
69
+ class NPKMagicBytesError (BaseException ):
70
+ pass
71
+
72
+
69
73
class NPKError (BaseException ):
70
74
pass
Original file line number Diff line number Diff line change 1
1
import struct
2
2
from pathlib import Path
3
3
4
- from npkpy .common import NPKError , NPKIdError
4
+ from npkpy .common import NPKError , NPKIdError , NPKMagicBytesError
5
5
from npkpy .npk .npk_constants import CNT_HANDLER
6
6
from npkpy .npk .cnt_basic import BYTES_LEN_CNT_ID , BYTES_LEN_CNT_PAYLOAD_LEN
7
7
from npkpy .npk .npk_file_basic import FileBasic
@@ -99,4 +99,4 @@ def __get_cnt(self, offset):
99
99
100
100
def _check_magic_bytes (self , error_msg ):
101
101
if not self .pck_magic_bytes == MAGIC_BYTES :
102
- raise NPKError (error_msg )
102
+ raise NPKMagicBytesError (error_msg )
Original file line number Diff line number Diff line change 3
3
import unittest
4
4
from pathlib import Path
5
5
6
- from npkpy .common import NPKError , NPKIdError
6
+ from npkpy .common import NPKError , NPKIdError , NPKMagicBytesError
7
7
from npkpy .npk .npk import Npk
8
8
from npkpy .npk .pck_header import PckHeader
9
9
from tests .constants import DummyHeaderCnt , MAGIC_BYTES , get_dummy_npk_binary
@@ -18,7 +18,7 @@ def setUp(self) -> None:
18
18
def test_fileIsNoNpkFile (self ):
19
19
self .npkFile .write_bytes (b"NoMagicBytesAtHeadOfFile" )
20
20
21
- with self .assertRaises (NPKError ) as e :
21
+ with self .assertRaises (NPKMagicBytesError ) as e :
22
22
_ = Npk (self .npkFile ).pck_magic_bytes
23
23
self .assertEqual (e .exception .args [0 ], "Magic bytes not found in Npk file" )
24
24
You can’t perform that action at this time.
0 commit comments