Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ccie18643 committed Sep 8, 2024
1 parent f80830f commit 5491860
Show file tree
Hide file tree
Showing 26 changed files with 467 additions and 497 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
ICMP6__ND__OPTION__SLLA__STRUCT = "! BB 6s"


@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, kw_only=False)
class Icmp6NdOptionSlla(Icmp6NdOption):
"""
The ICMPv6 ND Slla option support.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
ICMP6__ND__OPTION__TLLA__STRUCT = "! BB 6s"


@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, kw_only=False)
class Icmp6NdOptionTlla(Icmp6NdOption):
"""
The ICMPv6 ND Tlla option support.
Expand Down
2 changes: 1 addition & 1 deletion pytcp/protocols/ip4/options/ip4_option__eol.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
IP4__OPTION__EOL__STRUCT = "! B"


@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, kw_only=False)
class Ip4OptionEol(Ip4Option):
"""
The IPv4 Eol (End of Option List) option support.
Expand Down
2 changes: 1 addition & 1 deletion pytcp/protocols/ip4/options/ip4_option__nop.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
IP4__OPTION__NOP__STRUCT = "! B"


@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, kw_only=False)
class Ip4OptionNop(Ip4Option):
"""
The IPv4 Nop (No Operation) option support class.
Expand Down
2 changes: 1 addition & 1 deletion pytcp/protocols/tcp/options/tcp_option__eol.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
TCP__OPTION__EOL__STRUCT = "! B"


@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, kw_only=False)
class TcpOptionEol(TcpOption):
"""
The TCP Eol (End of Option List) option support.
Expand Down
2 changes: 1 addition & 1 deletion pytcp/protocols/tcp/options/tcp_option__mss.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
TCP__OPTION__MSS__STRUCT = "! BB H"


@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, kw_only=False)
class TcpOptionMss(TcpOption):
"""
The TCP Mss (Maximum Segment Size) option support class.
Expand Down
2 changes: 1 addition & 1 deletion pytcp/protocols/tcp/options/tcp_option__nop.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
TCP__OPTION__NOP__STRUCT = "! B"


@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, kw_only=False)
class TcpOptionNop(TcpOption):
"""
The TCP Nop (No Operation) option support class.
Expand Down
2 changes: 1 addition & 1 deletion pytcp/protocols/tcp/options/tcp_option__sack.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def __str__(self) -> str:
return f"{self.left}-{self.right}"


@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, kw_only=False)
class TcpOptionSack(TcpOption):
"""
The TCP Sack option support class.
Expand Down
2 changes: 1 addition & 1 deletion pytcp/protocols/tcp/options/tcp_option__sackperm.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
TCP__OPTION__SACKPERM__STRUCT = "! BB"


@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, kw_only=False)
class TcpOptionSackperm(TcpOption):
"""
The TCP Sackperm (SACK Permitted) option support class.
Expand Down
2 changes: 1 addition & 1 deletion pytcp/protocols/tcp/options/tcp_option__wscale.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
TCP__OPTION__WSCALE__MAX_VALUE = 14


@dataclass(frozen=True, kw_only=True)
@dataclass(frozen=True, kw_only=False)
class TcpOptionWscale(TcpOption):
"""
The TCP Wscale (Window Scale) option support class.
Expand Down
56 changes: 56 additions & 0 deletions tests/lib/testcase__option.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env python3

################################################################################
## ##
## PyTCP - Python TCP/IP stack ##
## Copyright (C) 2020-present Sebastian Majewski ##
## ##
## This program is free software: you can redistribute it and/or modify ##
## it under the terms of the GNU General Public License as published by ##
## the Free Software Foundation, either version 3 of the License, or ##
## (at your option) any later version. ##
## ##
## This program is distributed in the hope that it will be useful, ##
## but WITHOUT ANY WARRANTY; without even the implied warranty of ##
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ##
## GNU General Public License for more details. ##
## ##
## You should have received a copy of the GNU General Public License ##
## along with this program. If not, see <https://www.gnu.org/licenses/>. ##
## ##
## Author's email: [email protected] ##
## Github repository: https://github.com/ccie18643/PyTCP ##
## ##
################################################################################


"""
Module contains the customized TestCase class.
tests/mocks/testcase__packet_rx.py
ver 3.0.2
"""


from typing import Any

from testslide import TestCase

from pytcp.lib.packet import PacketRx


class TestCasePacketRx(TestCase):
"""
Customized TestCase class that provides PacketRx object.
"""

_args: list[Any] = []
_packet_rx: PacketRx

def setUp(self) -> None:
"""
Set up the PacketRx object.
"""

self._packet_rx = PacketRx(self._args[0])
Loading

0 comments on commit 5491860

Please sign in to comment.