diff --git a/docs/api/pyatv.conf.html b/docs/api/pyatv.conf.html index e3766fa09..ca2cec8b2 100644 --- a/docs/api/pyatv.conf.html +++ b/docs/api/pyatv.conf.html @@ -64,7 +64,7 @@

Classes

class AirPlayService -(identifier: Optional[str], port: int = 7000, credentials: Optional[str] = None, properties: Optional[Mapping[str, str]] = None) +(identifier: str | None, port: int = 7000, credentials: str | None = None, properties: Mapping[str, str] | None = None)

Representation of an AirPlay service.

@@ -97,7 +97,7 @@

Inherited members

class AppleTV -(address: ipaddress.IPv4Address, name: str, deep_sleep: bool = False, properties: Optional[Mapping[str, Mapping[str, str]]] = None, device_info: Optional[DeviceInfo] = None) +(address: ipaddress.IPv4Address, name: str, deep_sleep: bool = False, properties: Mapping[str, Mapping[str, str]] | None = None, device_info: DeviceInfo | None = None)

Representation of a device configuration.

@@ -135,7 +135,7 @@

Inherited members

class CompanionService -(port: int, credentials: Optional[str] = None, properties: Optional[Mapping[str, str]] = None) +(port: int, credentials: str | None = None, properties: Mapping[str, str] | None = None)

Representation of a Companion link service.

@@ -168,7 +168,7 @@

Inherited members

class DmapService -(identifier: Optional[str], credentials: Optional[str], port: int = 3689, properties: Optional[Mapping[str, str]] = None) +(identifier: str | None, credentials: str | None, port: int = 3689, properties: Mapping[str, str] | None = None)

Representation of a DMAP service.

@@ -201,7 +201,7 @@

Inherited members

class ManualService -(identifier: Optional[str], protocol: Protocol, port: int, properties: Optional[Mapping[str, str]], credentials: Optional[str] = None, password: Optional[str] = None, requires_password: bool = False, pairing_requirement: PairingRequirement = PairingRequirement.Unsupported, enabled: bool = True) +(identifier: str | None, protocol: Protocol, port: int, properties: Mapping[str, str] | None, credentials: str | None = None, password: str | None = None, requires_password: bool = False, pairing_requirement: PairingRequirement = PairingRequirement.Unsupported, enabled: bool = True)

Service used when manually creating and adding a service.

@@ -240,7 +240,7 @@

Inherited members

class MrpService -(identifier: Optional[str], port: int, credentials: Optional[str] = None, properties: Optional[Mapping[str, str]] = None) +(identifier: str | None, port: int, credentials: str | None = None, properties: Mapping[str, str] | None = None)

Representation of a MediaRemote Protocol (MRP) service.

@@ -273,7 +273,7 @@

Inherited members

class RaopService -(identifier: Optional[str], port: int = 7000, credentials: Optional[str] = None, password: Optional[str] = None, properties: Optional[Mapping[str, str]] = None) +(identifier: str | None, port: int = 7000, credentials: str | None = None, password: str | None = None, properties: Mapping[str, str] | None = None)

Representation of an RAOP service.

diff --git a/docs/api/pyatv.const.html b/docs/api/pyatv.const.html index 1fca6d199..d3b5afbaa 100644 --- a/docs/api/pyatv.const.html +++ b/docs/api/pyatv.const.html @@ -950,19 +950,19 @@

Class variables

var Click = 5
-
+

The type of the None singleton.

var Hold = 3
-
+

The type of the None singleton.

var Press = 1
-
+

The type of the None singleton.

var Release = 4
-
+

The type of the None singleton.

diff --git a/docs/api/pyatv.convert.html b/docs/api/pyatv.convert.html index cce1f6081..b37750e4d 100644 --- a/docs/api/pyatv.convert.html +++ b/docs/api/pyatv.convert.html @@ -49,6 +49,7 @@

Functions

Convert internal API device state to string.

+
@@ -57,6 +58,7 @@

Functions

Convert internal API media type to string.

+
@@ -65,6 +67,7 @@

Functions

Convert device model to string.

+
@@ -73,6 +76,7 @@

Functions

Convert internal API protocol to string.

+
@@ -81,6 +85,7 @@

Functions

Convert internal API repeat state to string.

+
@@ -89,6 +94,7 @@

Functions

Convert internal API shuffle state to string.

+
diff --git a/docs/api/pyatv.exceptions.html b/docs/api/pyatv.exceptions.html index a368b1ecc..674273c73 100644 --- a/docs/api/pyatv.exceptions.html +++ b/docs/api/pyatv.exceptions.html @@ -232,6 +232,7 @@

Instance variables

var status_code -> int

Return status code that triggered the error.

+
diff --git a/docs/api/pyatv.helpers.html b/docs/api/pyatv.helpers.html index b70e1cd17..efa98cfdc 100644 --- a/docs/api/pyatv.helpers.html +++ b/docs/api/pyatv.helpers.html @@ -42,7 +42,7 @@

Functions

-async def auto_connect(handler: Callable[[AppleTV], None], timeout: int = 5, not_found: Optional[Callable[[], None]] = None, loop: Optional[asyncio.events.AbstractEventLoop] = None) -> None +async def auto_connect(handler: Callable[[AppleTV], None], timeout: int = 5, not_found: Callable[[], None] | None = None, loop: asyncio.events.AbstractEventLoop | None = None) -> None
@@ -52,10 +52,11 @@

Functions

optional error handler can be provided that is called when no device was found. Very inflexible in many cases, but can be handys sometimes when trying things.

Note: both handler and not_found must be coroutines

+
-def get_unique_id(service_type: str, service_name: str, properties: Mapping[str, str]) -> Optional[str] +def get_unique_id(service_type: str, service_name: str, properties: Mapping[str, str]) -> str | None
@@ -64,6 +65,7 @@

Functions

service_name name of the service (e.g. Office or Living Room) and properties all key-value properties belonging to the service.

The unique identifier is returned if available, otherwise None is returned.

+
@@ -76,6 +78,7 @@

Functions

PairingRequirement.Unsupported or PairingRequirement.Disabled. In all other cases it will return True. Do note that even if this method returns True, pairing (or that existing credentials are provided) might still be needed.

+
@@ -87,6 +90,7 @@

Functions

This method will return if the file format of the given file is supported and streamable by pyatv. It will never raise an exception, e.g. because the file is missing or lack of permissions.

+
diff --git a/docs/api/pyatv.html b/docs/api/pyatv.html index 3a7d18ac8..01bd41786 100644 --- a/docs/api/pyatv.html +++ b/docs/api/pyatv.html @@ -83,29 +83,32 @@

Functions

-async def connect(config: BaseConfig, loop: asyncio.events.AbstractEventLoop, protocol: Optional[Protocol] = None, session: Optional[aiohttp.client.ClientSession] = None, storage: Optional[Storage] = None) -> AppleTV +async def connect(config: BaseConfig, loop: asyncio.events.AbstractEventLoop, protocol: Protocol | None = None, session: aiohttp.client.ClientSession | None = None, storage: Storage | None = None) -> AppleTV

Connect to a device based on a configuration.

+
-async def pair(config: BaseConfig, protocol: Protocol, loop: asyncio.events.AbstractEventLoop, session: aiohttp.client.ClientSession = None, storage: Optional[Storage] = None, **kwargs) -> PairingHandler +async def pair(config: BaseConfig, protocol: Protocol, loop: asyncio.events.AbstractEventLoop, session: aiohttp.client.ClientSession = None, storage: Storage | None = None, **kwargs) -> PairingHandler

Pair a protocol for an Apple TV.

+
-async def scan(loop: asyncio.events.AbstractEventLoop, timeout: int = 5, identifier: Union[str, Set[str], ForwardRef(None)] = None, protocol: Union[Protocol, Set[Protocol], ForwardRef(None)] = None, hosts: Optional[List[str]] = None, aiozc: Optional[zeroconf.asyncio.AsyncZeroconf] = None, storage: Optional[Storage] = None) -> List[BaseConfig] +async def scan(loop: asyncio.events.AbstractEventLoop, timeout: int = 5, identifier: str | Set[str] | None = None, protocol: Protocol | Set[Protocol] | None = None, hosts: List[str] | None = None, aiozc: zeroconf.asyncio.AsyncZeroconf | None = None, storage: Storage | None = None) -> List[BaseConfig]

Scan for Apple TVs on network and return their configurations.

When passing in an aiozc instance, a ServiceBrowser must be running for all the types in the protocols that being scanned for.

+
diff --git a/docs/api/pyatv.interface.html b/docs/api/pyatv.interface.html index b32de95f6..20780e1f4 100644 --- a/docs/api/pyatv.interface.html +++ b/docs/api/pyatv.interface.html @@ -362,6 +362,7 @@

Functions

Retrieve all commands and help texts from an API object.

+
@@ -370,7 +371,7 @@

Classes

class App -(name: Optional[str], identifier: str) +(name: str | None, identifier: str)

Information about an app.

@@ -381,10 +382,12 @@

Instance variables

var identifier -> str

Return a unique bundle id for the app.

+
-
var name -> Optional[str]
+
var name -> str | None

User friendly name of app.

+
@@ -412,58 +415,72 @@

Instance variables

var apps -> Apps

Return apps interface.

+
var audio -> Audio

Return audio interface.

+
var device_info -> DeviceInfo

Return API for device information.

+
var features -> Features

Return features interface.

+
var keyboard -> Keyboard

Return keyboard interface.

+
var metadata -> Metadata

Return API for retrieving metadata from the Apple TV.

+
var power -> Power

Return API for power management.

+
var push_updater -> PushUpdater

Return API for handling push update from the Apple TV.

+
var remote_control -> RemoteControl

Return API for controlling the Apple TV.

+
var service -> BaseService

Return service used to connect to the Apple TV.

+
var settings -> Settings

Return device settings used by pyatv.

+
var stream -> Stream

Return API for streaming media.

+
var touch -> TouchGestures

Return touch gestures interface.

+
var user_accounts -> UserAccounts

Return user accounts interface.

+

Methods

@@ -475,6 +492,7 @@

Methods

Close connection and release allocated resources.

+
@@ -484,6 +502,7 @@

Methods

Initiate connection to device.

No need to call it yourself, it's done automatically.

+
@@ -511,6 +530,7 @@

Methods

Supported by: Protocol.Companion

Fetch a list of apps that can be launched.

+
@@ -523,6 +543,7 @@

Methods

Supported by: Protocol.Companion

Launch an app based on bundle ID or URL.

+ @@ -542,18 +563,22 @@

Instance variables

var bytes -> bytes

Alias for field number 0

+
var height -> int

Alias for field number 3

+
var mimetype -> str

Alias for field number 1

+
var width -> int

Alias for field number 2

+
@@ -586,11 +611,13 @@

Instance variables

var output_devices -> List[OutputDevice]

Return current list of output device IDs.

+
var volume -> float

Return current volume level.

Range is in percent, i.e. [0.0-100.0].

+

Methods

@@ -606,6 +633,7 @@

Methods

Supported by: Protocol.MRP

Add output devices.

+
@@ -618,6 +646,7 @@

Methods

Supported by: Protocol.MRP

Remove output devices.

+
@@ -630,6 +659,7 @@

Methods

Supported by: Protocol.MRP

Set output devices.

+
@@ -643,6 +673,7 @@

Methods

Change current volume level.

Range is in percent, i.e. [0.0-100.0].

+
@@ -659,6 +690,7 @@

Methods

range. It is not necessarily linear.

Call will block until volume change has been acknowledged by the device (when possible and supported).

+
@@ -675,6 +707,7 @@

Methods

range. It is not necessarily linear.

Call will block until volume change has been acknowledged by the device (when possible and supported).

+ @@ -701,6 +734,7 @@

Methods

Output devices were updated.

+
@@ -709,6 +743,7 @@

Methods

Device volume was updated.

+
@@ -736,38 +771,47 @@

Instance variables

var address -> ipaddress.IPv4Address

IP address of device.

+
var all_identifiers -> List[str]

Return all unique identifiers for this device.

+
var deep_sleep -> bool

If device is in deep sleep.

+
var device_info -> DeviceInfo

Return general device information.

+
-
var identifier -> Optional[str]
+
var identifier -> str | None

Return the main identifier associated with this device.

+
var name -> str

Name of device.

+
var properties -> Mapping[str, Mapping[str, str]]

Return Zeroconf properties.

+
var ready -> bool

Return if configuration is ready, (at least one service with identifier).

+
var services -> List[BaseService]

Return all supported services.

+

Methods

@@ -780,6 +824,7 @@

Methods

Add a new service.

If the service already exists, it will be merged.

+
@@ -788,24 +833,27 @@

Methods

Apply settings to configuration.

+
-def get_service(self, protocol: Protocol) -> Optional[BaseService] +def get_service(self, protocol: Protocol) -> BaseService | None

Look up a service based on protocol.

If a service with the specified protocol is not available, None is returned.

+
-def main_service(self, protocol: Optional[Protocol] = None) -> BaseService +def main_service(self, protocol: Protocol | None = None) -> BaseService

Return suggested service used to establish connection.

+
@@ -814,12 +862,13 @@

Methods

Set credentials for a protocol if it exists.

+
class BaseService -(identifier: Optional[str], protocol: Protocol, port: int, properties: Optional[Mapping[str, str]], credentials: Optional[str] = None, password: Optional[str] = None, enabled: bool = True) +(identifier: str | None, protocol: Protocol, port: int, properties: Mapping[str, str] | None, credentials: str | None = None, password: str | None = None, enabled: bool = True)

Base class for protocol services.

@@ -839,30 +888,37 @@

Instance variables

var enabled -> bool

Return True if service is enabled.

+
-
var identifier -> Optional[str]
+
var identifier -> str | None

Return unique identifier associated with this service.

+
var pairing -> PairingRequirement

Return if pairing is required by service.

+
var port -> int

Return service port number.

+
var properties -> Mapping[str, str]

Return service Zeroconf properties.

+
var protocol -> Protocol

Return protocol type.

+
var requires_password -> bool

Return if a password is required to access service.

+

Methods

@@ -877,6 +933,7 @@

Methods

Expects the same format as returned by settings() method. Unknown properties are silently ignored. Settings with a None value are also ignore (keeps original value).

+
@@ -886,6 +943,7 @@

Methods

Merge with other service of same type.

Merge will only include credentials, password and properties.

+
@@ -894,6 +952,7 @@

Methods

Return settings and their values.

+
@@ -909,46 +968,54 @@

Class variables

var OUTPUT_DEVICE_ID
-
+

The type of the None singleton.

Instance variables

-
var build_number -> Optional[str]
+
var build_number -> str | None

Operating system build number, e.g. 17K795.

+
-
var mac -> Optional[str]
+
var mac -> str | None

Device MAC address.

+
var model -> DeviceModel

Hardware model name, e.g. 3, 4 or 4K.

+
var model_str -> str

Return model name as string.

This property will return the model name as a string and fallback to raw_model if it is not available.

+
var operating_system -> OperatingSystem

Operating system running on device.

+
-
var output_device_id -> Optional[str]
+
var output_device_id -> str | None

Output device identifier.

+
-
var raw_model -> Optional[str]
+
var raw_model -> str | None

Return raw model description.

If DeviceInfo.model returns DeviceModel.Unknown then this property contains the raw model string (if any is available).

+
-
var version -> Optional[str]
+
var version -> str | None

Operating system version.

+
@@ -976,6 +1043,7 @@

Methods

Device connection was (intentionally) closed.

+
@@ -984,12 +1052,13 @@

Methods

Device was unexpectedly disconnected.

+
class FeatureInfo -(state: FeatureState, options: Optional[Dict[str, object]] = {}) +(state: FeatureState, options: Dict[str, object] | None = {})

Feature state and options.

@@ -1000,13 +1069,15 @@

Ancestors

Instance variables

-
var options -> Optional[Dict[str, object]]
+
var options -> Dict[str, object] | None

Alias for field number 1

+
var state -> FeatureState

Alias for field number 0

+
@@ -1034,6 +1105,7 @@

Methods

Return state of all features.

+
@@ -1042,10 +1114,11 @@

Methods

Return current state of a feature.

+
-def in_state(self, states: Union[List[FeatureState], FeatureState], *feature_names: FeatureName) -> bool +def in_state(self, states: List[FeatureState] | FeatureState, *feature_names: FeatureName) -> bool
@@ -1053,6 +1126,7 @@

Methods

This method will return True if all given features are in the state specified by "states". If "states" is a list of states, it is enough for the feature to be in one of the listed states.

+
@@ -1082,6 +1156,7 @@

Instance variables

var text_focus_state -> KeyboardFocusState

Return keyboard focus state.

+

Methods

@@ -1097,6 +1172,7 @@

Methods

Supported by: Protocol.Companion

Input text into virtual keyboard.

+
@@ -1109,10 +1185,11 @@

Methods

Supported by: Protocol.Companion

Clear virtual keyboard text.

+
-async def text_get(self) -> Optional[str] +async def text_get(self) -> str | None
@@ -1121,6 +1198,7 @@

Methods

Supported by: Protocol.Companion

Get current virtual keyboard text.

+
@@ -1133,6 +1211,7 @@

Methods

Supported by: Protocol.Companion

Replace text in virtual keyboard.

+ @@ -1159,37 +1238,38 @@

Methods

Keyboard focus state was updated.

+
class MediaMetadata -(title: Optional[str] = None, artist: Optional[str] = None, album: Optional[str] = None, artwork: Optional[bytes] = None, duration: Optional[float] = None) +(title: str | None = None, artist: str | None = None, album: str | None = None, artwork: bytes | None = None, duration: float | None = None)

Container for media (e.g. audio or video) metadata.

Class variables

-
var album -> Optional[str]
+
var album -> str | None
-
+

The type of the None singleton.

-
var artist -> Optional[str]
+
var artist -> str | None
-
+

The type of the None singleton.

-
var artwork -> Optional[bytes]
+
var artwork -> bytes | None
-
+

The type of the None singleton.

-
var duration -> Optional[float]
+
var duration -> float | None
-
+

The type of the None singleton.

-
var title -> Optional[str]
+
var title -> str | None
-
+

The type of the None singleton.

@@ -1208,27 +1288,30 @@

Subclasses

Instance variables

-
var app -> Optional[App]
+
var app -> App | None

Return information about current app playing something.

Do note that this property returns which app is currently playing something and not which app is currently active. If nothing is playing, the corresponding feature will be unavailable.

+
var artwork_id -> str

Return a unique identifier for current artwork.

+
-
var device_id -> Optional[str]
+
var device_id -> str | None

Return a unique identifier for current device.

+

Methods

-async def artwork(self, width: Optional[int] = 512, height: Optional[int] = None) -> Optional[ArtworkInfo] +async def artwork(self, width: int | None = 512, height: int | None = None) -> ArtworkInfo | None
@@ -1242,6 +1325,7 @@

Methods

return artwork of a different size. Set both parameters to None to request default size. Set one of them and let the other one be None to keep original aspect ratio.

+
@@ -1250,12 +1334,13 @@

Methods

Return what is currently playing.

+
class OutputDevice -(name: Optional[str], identifier: str) +(name: str | None, identifier: str)

Information about an output device.

@@ -1266,10 +1351,12 @@

Instance variables

var identifier -> str

Return a unique id for the output device.

+
-
var name -> Optional[str]
+
var name -> str | None

User friendly name of output device.

+
@@ -1297,15 +1384,18 @@

Instance variables

var device_provides_pin -> bool

Return True if remote device presents PIN code, else False.

+
var has_paired -> bool

If a successful pairing has been performed.

The value will be reset when stop() is called.

+
var service -> BaseService

Return service used for pairing.

+

Methods

@@ -1317,6 +1407,7 @@

Methods

Start pairing process.

+
@@ -1325,6 +1416,7 @@

Methods

Call to free allocated resources after pairing.

+
@@ -1333,6 +1425,7 @@

Methods

Stop pairing process.

+
@@ -1341,12 +1434,13 @@

Methods

Pin code used for pairing.

+
class Playing -(media_type: MediaType = MediaType.Unknown, device_state: DeviceState = DeviceState.Idle, title: Optional[str] = None, artist: Optional[str] = None, album: Optional[str] = None, genre: Optional[str] = None, total_time: Optional[int] = None, position: Optional[int] = None, shuffle: Optional[ShuffleState] = None, repeat: Optional[RepeatState] = None, hash: Optional[str] = None, series_name: Optional[str] = None, season_number: Optional[int] = None, episode_number: Optional[int] = None, content_identifier: Optional[str] = None, itunes_store_identifier: Optional[int] = None) +(media_type: MediaType = MediaType.Unknown, device_state: DeviceState = DeviceState.Idle, title: str | None = None, artist: str | None = None, album: str | None = None, genre: str | None = None, total_time: int | None = None, position: int | None = None, shuffle: ShuffleState | None = None, repeat: RepeatState | None = None, hash: str | None = None, series_name: str | None = None, season_number: int | None = None, episode_number: int | None = None, content_identifier: str | None = None, itunes_store_identifier: int | None = None)

Base class for retrieving what is currently playing.

@@ -1358,71 +1452,87 @@

Ancestors

Instance variables

-
var album -> Optional[str]
+
var album -> str | None

Album of the currently playing song.

+
-
var artist -> Optional[str]
+
var artist -> str | None

Artist of the currently playing song.

+
-
var content_identifier -> Optional[str]
+
var content_identifier -> str | None

Content identifier (app specific).

+
var device_state -> DeviceState

Device state, e.g. playing or paused.

+
-
var episode_number -> Optional[int]
+
var episode_number -> int | None

Episode number of TV series.

+
-
var genre -> Optional[str]
+
var genre -> str | None

Genre of the currently playing song.

+
var hash -> str

Create a unique hash for what is currently playing.

The hash is based on title, artist, album and total time. It should always be the same for the same content, but it is not guaranteed.

+
-
var itunes_store_identifier -> Optional[int]
+
var itunes_store_identifier -> int | None

Itunes Store identifier.

+
var media_type -> MediaType

Type of media is currently playing, e.g. video, music.

+
-
var position -> Optional[int]
+
var position -> int | None

Position in the playing media (seconds).

+
-
var repeat -> Optional[RepeatState]
+
var repeat -> RepeatState | None

Repeat mode.

+
-
var season_number -> Optional[int]
+
var season_number -> int | None

Season number of TV series.

+
-
var series_name -> Optional[str]
+
var series_name -> str | None

Title of TV series.

+
-
var shuffle -> Optional[ShuffleState]
+
var shuffle -> ShuffleState | None

If shuffle is enabled or not.

+
-
var title -> Optional[str]
+
var title -> str | None

Title of the current media, e.g. movie or song name.

+
-
var total_time -> Optional[int]
+
var total_time -> int | None

Total play time in seconds.

+
@@ -1452,6 +1562,7 @@

Instance variables

var power_state -> PowerState

Return device power state.

+

Methods

@@ -1467,6 +1578,7 @@

Methods

Supported by: Protocol.Companion, Protocol.MRP

Turn device off.

+
@@ -1479,6 +1591,7 @@

Methods

Supported by: Protocol.Companion, Protocol.MRP

Turn device on.

+ @@ -1507,6 +1620,7 @@

Methods

Device power state was updated.

+
@@ -1535,6 +1649,7 @@

Methods

Inform about an error when updating play status.

+
@@ -1543,6 +1658,7 @@

Methods

Inform about changes to what is currently playing.

+
@@ -1573,6 +1689,7 @@

Instance variables

var active -> bool

Return if push updater has been started.

+

Methods

@@ -1589,6 +1706,7 @@

Methods

Begin to listen to updates.

If an error occurs, start must be called again.

+
@@ -1597,6 +1715,7 @@

Methods

No longer forward updates to listener.

+
@@ -1628,6 +1747,7 @@

Methods

Supported by: Protocol.Companion

Select previous channel.

+
@@ -1640,6 +1760,7 @@

Methods

Supported by: Protocol.Companion

Select next channel.

+
@@ -1652,6 +1773,7 @@

Methods

Supported by: Protocol.Companion, Protocol.DMAP, Protocol.MRP

Press key down.

+
@@ -1664,6 +1786,7 @@

Methods

Supported by: Protocol.Companion, Protocol.MRP

Press key home.

+
@@ -1676,6 +1799,7 @@

Methods

Supported by: Protocol.MRP

Hold key home.

+
@@ -1688,6 +1812,7 @@

Methods

Supported by: Protocol.Companion, Protocol.DMAP, Protocol.MRP

Press key left.

+
@@ -1700,6 +1825,7 @@

Methods

Supported by: Protocol.Companion, Protocol.DMAP, Protocol.MRP

Press key menu.

+
@@ -1712,6 +1838,7 @@

Methods

Supported by: Protocol.Companion, Protocol.DMAP, Protocol.MRP

Press key next.

+
@@ -1724,6 +1851,7 @@

Methods

Supported by: Protocol.Companion, Protocol.DMAP, Protocol.MRP, Protocol.RAOP

Press key pause.

+
@@ -1736,6 +1864,7 @@

Methods

Supported by: Protocol.Companion, Protocol.DMAP, Protocol.MRP

Press key play.

+
@@ -1748,6 +1877,7 @@

Methods

Supported by: Protocol.Companion, Protocol.DMAP, Protocol.MRP

Toggle between play and pause.

+
@@ -1760,6 +1890,7 @@

Methods

Supported by: Protocol.Companion, Protocol.DMAP, Protocol.MRP

Press key previous.

+
@@ -1772,6 +1903,7 @@

Methods

Supported by: Protocol.Companion, Protocol.DMAP, Protocol.MRP

Press key right.

+
@@ -1784,6 +1916,7 @@

Methods

Supported by: Protocol.Companion

Activate screen saver..

+
@@ -1796,6 +1929,7 @@

Methods

Supported by: Protocol.Companion, Protocol.DMAP, Protocol.MRP

Press key select.

+
@@ -1808,6 +1942,7 @@

Methods

Supported by: Protocol.DMAP, Protocol.MRP

Seek in the current playing media.

+
@@ -1820,6 +1955,7 @@

Methods

Supported by: Protocol.DMAP, Protocol.MRP

Change repeat state.

+
@@ -1832,6 +1968,7 @@

Methods

Supported by: Protocol.DMAP, Protocol.MRP

Change shuffle mode to on or off.

+
@@ -1846,6 +1983,7 @@

Methods

Skip backward a time interval.

If time_interval is not positive or not present, a default or app-chosen time interval is used, which is typically 10, 15, 30, etc. seconds.

+
@@ -1860,6 +1998,7 @@

Methods

Skip forward a time interval.

If time_interval is not positive or not present, a default or app-chosen time interval is used, which is typically 10, 15, 30, etc. seconds.

+
@@ -1872,6 +2011,7 @@

Methods

Supported by: Protocol.AirPlay, Protocol.DMAP, Protocol.MRP, Protocol.RAOP

Press key stop.

+
@@ -1885,6 +2025,7 @@

Methods

Suspend the device.

DEPRECATED: Use Power.turn_off() instead.

+
@@ -1897,6 +2038,7 @@

Methods

Supported by: Protocol.DMAP, Protocol.MRP

Go to main menu (long press menu).

+
@@ -1909,6 +2051,7 @@

Methods

Supported by: Protocol.Companion, Protocol.DMAP, Protocol.MRP

Press key up.

+
@@ -1922,6 +2065,7 @@

Methods

Press key volume down.

DEPRECATED: Use Audio.volume_down() instead.

+
@@ -1935,6 +2079,7 @@

Methods

Press key volume up.

DEPRECATED: Use Audio.volume_up() instead.

+
@@ -1948,6 +2093,7 @@

Methods

Wake up the device.

DEPRECATED: Use Power.turn_on() instead.

+ @@ -1970,6 +2116,7 @@

Instance variables

var settings -> Sequence[Settings]

Return settings for all devices.

+

Methods

@@ -1986,6 +2133,7 @@

Methods

If no settings exists for the current configuration, new settings are created automatically and returned. If the configuration does not contain any valid identitiers, DeviceIdMissingError will be raised.

+
@@ -1994,6 +2142,7 @@

Methods

Load settings from active storage.

+
@@ -2003,6 +2152,7 @@

Methods

Remove settings from storage.

Returns True if settings were removed, otherwise False.

+
@@ -2011,6 +2161,7 @@

Methods

Save settings to active storage.

+
@@ -2021,6 +2172,7 @@

Methods

Update settings based on config.

This method extracts settings from a configuration and writes them back to the storage.

+ @@ -2045,6 +2197,7 @@

Methods

Close connection and release allocated resources.

+
@@ -2057,10 +2210,11 @@

Methods

Supported by: Protocol.AirPlay

Play media from an URL on the device.

+
-async def stream_file(self, file: Union[str, io.BufferedIOBase, asyncio.streams.StreamReader], /, metadata: Optional[MediaMetadata] = None, override_missing_metadata: bool = False, **kwargs) -> None +async def stream_file(self, file: str | io.BufferedIOBase | asyncio.streams.StreamReader, /, metadata: MediaMetadata | None = None, override_missing_metadata: bool = False, **kwargs) -> None
@@ -2071,6 +2225,7 @@

Methods

Stream local or remote file to device.

Supports either local file paths or a HTTP(s) address.

INCUBATING METHOD - MIGHT CHANGE IN THE FUTURE!

+
@@ -2105,6 +2260,7 @@

Methods

:param x: x coordinate :param y: y coordinate :param mode: touch mode (1: press, 3: hold, 4: release)

+
@@ -2118,6 +2274,7 @@

Methods

Send a touch click.

:param action: action mode single tap (0), double tap (1), or hold (2)

+
@@ -2137,6 +2294,7 @@

Methods

:param end_x: End x coordinate :param end_y: Endi x coordinate :param duration_ms: Time in milliseconds to reach the end coordinates

+ @@ -2153,10 +2311,12 @@

Instance variables

var identifier -> str

Return a unique id for the account.

+
-
var name -> Optional[str]
+
var name -> str | None

User name.

+
@@ -2184,6 +2344,7 @@

Methods

Supported by: Protocol.Companion

Fetch a list of user accounts that can be switched.

+
@@ -2196,6 +2357,7 @@

Methods

Supported by: Protocol.Companion

Switch user account by account ID.

+ diff --git a/docs/api/pyatv.settings.html b/docs/api/pyatv.settings.html index 36a548132..85ed5a641 100644 --- a/docs/api/pyatv.settings.html +++ b/docs/api/pyatv.settings.html @@ -134,17 +134,17 @@

Ancestors

Class variables

-
var credentials -> Optional[str]
+
var credentials -> str | None
-
+

The type of the None singleton.

-
var identifier -> Optional[str]
+
var identifier -> str | None
-
+

The type of the None singleton.

-
var password -> Optional[str]
+
var password -> str | None
-
+

The type of the None singleton.

@@ -164,15 +164,15 @@

Class variables

var Auto = auto
-
+

The type of the None singleton.

var V1 = 1
-
+

The type of the None singleton.

var V2 = 2
-
+

The type of the None singleton.

@@ -192,13 +192,13 @@

Ancestors

Class variables

-
var credentials -> Optional[str]
+
var credentials -> str | None
-
+

The type of the None singleton.

-
var identifier -> Optional[str]
+
var identifier -> str | None
-
+

The type of the None singleton.

@@ -218,13 +218,13 @@

Ancestors

Class variables

-
var credentials -> Optional[str]
+
var credentials -> str | None
-
+

The type of the None singleton.

-
var identifier -> Optional[str]
+
var identifier -> str | None
-
+

The type of the None singleton.

@@ -246,31 +246,31 @@

Class variables

var device_id -> str
-
+

The type of the None singleton.

var mac -> str
-
+

The type of the None singleton.

var model -> str
-
+

The type of the None singleton.

var name -> str
-
+

The type of the None singleton.

var os_build -> str
-
+

The type of the None singleton.

var os_name -> str
-
+

The type of the None singleton.

var os_version -> str
-
+

The type of the None singleton.

Static methods

@@ -301,13 +301,13 @@

Ancestors

Class variables

-
var credentials -> Optional[str]
+
var credentials -> str | None
-
+

The type of the None singleton.

-
var identifier -> Optional[str]
+
var identifier -> str | None
-
+

The type of the None singleton.

@@ -329,23 +329,23 @@

Class variables

var airplay -> AirPlaySettings
-
+

The type of the None singleton.

var companion -> CompanionSettings
-
+

The type of the None singleton.

var dmap -> DmapSettings
-
+

The type of the None singleton.

var mrp -> MrpSettings
-
+

The type of the None singleton.

var raop -> RaopSettings
-
+

The type of the None singleton.

@@ -370,17 +370,17 @@

Class variables

Server side (UDP) port used by control server.

Set to 0 to use random free port.

-
var credentials -> Optional[str]
+
var credentials -> str | None
-
+

The type of the None singleton.

-
var identifier -> Optional[str]
+
var identifier -> str | None
-
+

The type of the None singleton.

-
var password -> Optional[str]
+
var password -> str | None
-
+

The type of the None singleton.

var protocol_version -> AirPlayVersion
@@ -413,11 +413,11 @@

Class variables

var info -> InfoSettings
-
+

The type of the None singleton.

var protocols -> ProtocolSettings
-
+

The type of the None singleton.

diff --git a/docs/api/pyatv.storage.file_storage.html b/docs/api/pyatv.storage.file_storage.html index 2809345e4..47bd205fe 100644 --- a/docs/api/pyatv.storage.file_storage.html +++ b/docs/api/pyatv.storage.file_storage.html @@ -74,6 +74,7 @@

Static methods

applications.

The path used for this file is $HOME/.pyatv.conf (C:\Users\.pyatv.conf on Windows).

+

Inherited members

diff --git a/docs/api/pyatv.storage.html b/docs/api/pyatv.storage.html index e9b08cd83..74e062a9e 100644 --- a/docs/api/pyatv.storage.html +++ b/docs/api/pyatv.storage.html @@ -100,10 +100,12 @@

Instance variables

This property will return True if a any setting has been changed. It is reset when data is loaded into storage (by calling load) or manually by calling mark_as_solved (typically done by save).

+
var storage_model -> StorageModel

Return storage model representation.

+

Methods

@@ -122,6 +124,7 @@

Methods

identitiers, DeviceIdMissingError will be raised.

If settings exists for a configuration but mismatch, they will be automatically updated in the storage. Set ignore_update to False to not update storage.

+
@@ -132,6 +135,7 @@

Methods

Call after saving to indicate settings have been saved.

The changed property reflects whether something has been changed in the model or not based on calling this method.

+

Inherited members

@@ -165,11 +169,11 @@

Class variables

var devices -> List[Settings]
-
+

The type of the None singleton.

var version -> int
-
+

The type of the None singleton.

diff --git a/pyatv/auth/server_auth.py b/pyatv/auth/server_auth.py index 48ec2576e..d3fb06f69 100644 --- a/pyatv/auth/server_auth.py +++ b/pyatv/auth/server_auth.py @@ -10,4 +10,4 @@ + "336434633413641" ) SERVER_IDENTIFIER = "5D797FD3-3538-427E-A47B-A32FC6CF3A6A" -PRIVATE_KEY = 32 * b"\xAA" +PRIVATE_KEY = 32 * b"\xaa" diff --git a/pyatv/core/mdns.py b/pyatv/core/mdns.py index 1511fd695..f48f6ff85 100644 --- a/pyatv/core/mdns.py +++ b/pyatv/core/mdns.py @@ -64,7 +64,7 @@ def decode_value(value: bytes): """ try: return ( - value.replace(b"\xC2\xA0", b" ").replace(b"\x00\xA0", b" ").decode("utf-8") + value.replace(b"\xc2\xa0", b" ").replace(b"\x00\xa0", b" ").decode("utf-8") ) except Exception: # pylint: disable=broad-except return str(value) diff --git a/pyatv/protocols/raop/stream_client.py b/pyatv/protocols/raop/stream_client.py index 8598b45b4..1e4ff9474 100644 --- a/pyatv/protocols/raop/stream_client.py +++ b/pyatv/protocols/raop/stream_client.py @@ -162,7 +162,7 @@ def _retransmit_lost_packets(self, request, addr): # Very "low level" here just because it's simple and avoids # unnecessary conversions original_seqno = packet[2:4] - resp = b"\x80\xD6" + original_seqno + packet + resp = b"\x80\xd6" + original_seqno + packet if self.transport: self.transport.sendto(resp, addr) diff --git a/scripts/chickn.py b/scripts/chickn.py index 69fe5b47b..6ce6870bf 100755 --- a/scripts/chickn.py +++ b/scripts/chickn.py @@ -294,7 +294,7 @@ def main() -> None: loop = asyncio.ProactorEventLoop() asyncio.set_event_loop(loop) else: - loop = asyncio.get_event_loop() + loop = asyncio.new_event_loop() return loop.run_until_complete(appstart(loop)) diff --git a/tests/auth/test_hap_tlv8.py b/tests/auth/test_hap_tlv8.py index 4ba0eb489..1fce1a1c8 100644 --- a/tests/auth/test_hap_tlv8.py +++ b/tests/auth/test_hap_tlv8.py @@ -109,9 +109,9 @@ def test_stringify_unknown_values(): assert ( stringify( { - TlvValue.Method: b"\xAA", - TlvValue.SeqNo: b"\xAB", - TlvValue.Error: b"\xAC", + TlvValue.Method: b"\xaa", + TlvValue.SeqNo: b"\xab", + TlvValue.Error: b"\xac", 0xAD: b"\x01\x02\x03", } ) diff --git a/tests/core/test_scan.py b/tests/core/test_scan.py index ada443d4a..b6037082f 100644 --- a/tests/core/test_scan.py +++ b/tests/core/test_scan.py @@ -146,7 +146,7 @@ const._TYPE_TXT, const._CLASS_IN, const._DNS_OTHER_TTL, - b"\x0Cmodel=J305AP", + b"\x0cmodel=J305AP", ) SLEEP_PROXY_RECORDS = [ SLEEP_PROXY_PTR_RECORD, diff --git a/tests/protocols/dmap/test_dmap_pairing.py b/tests/protocols/dmap/test_dmap_pairing.py index ef1c6deb8..fa5af3be6 100644 --- a/tests/protocols/dmap/test_dmap_pairing.py +++ b/tests/protocols/dmap/test_dmap_pairing.py @@ -105,7 +105,7 @@ async def test_zeroconf_service_published(mock_pairing): assert [ipaddress.ip_address("10.0.10.1").packed] == service.addresses -@pytest.mark.parametrize("addresses", [(["1.2.3.4"])]) +@pytest.mark.parametrize("addresses", [["1.2.3.4"]]) async def test_zeroconf_custom_addresses(mock_pairing, addresses): _, zeroconf, _ = await mock_pairing(addresses=addresses) diff --git a/tests/protocols/dmap/test_parser.py b/tests/protocols/dmap/test_parser.py index 5fa17dd1d..c7181c927 100644 --- a/tests/protocols/dmap/test_parser.py +++ b/tests/protocols/dmap/test_parser.py @@ -72,7 +72,7 @@ def test_parse_binary_plist(): def test_parse_bytes(): - in_data = tags.raw_tag("byte", b"\x01\xAA\xFF\x45") + in_data = tags.raw_tag("byte", b"\x01\xaa\xff\x45") parsed = parser.parse(in_data, lookup_tag) assert 1 == len(parsed) assert "0x01aaff45" == parser.first(parsed, "byte") diff --git a/tests/protocols/raop/test_raop_functional.py b/tests/protocols/raop/test_raop_functional.py index 87828777a..737b323b8 100644 --- a/tests/protocols/raop/test_raop_functional.py +++ b/tests/protocols/raop/test_raop_functional.py @@ -129,7 +129,7 @@ async def test_stream_file_verify_metadata(raop_client, raop_state, metadata): assert raop_state.metadata.title == metadata["title"] -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_stream_complete_file(raop_client, raop_state): await raop_client.stream.stream_file(data_path("audio_10_frames.wav")) @@ -137,7 +137,7 @@ async def test_stream_complete_file(raop_client, raop_state): @pytest.mark.skip(reason="unstable, must investigate") -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_stream_complete_file_verify_padding(raop_client, raop_state): await raop_client.stream.stream_file(data_path("audio_10_frames.wav")) @@ -254,7 +254,7 @@ async def test_stream_retransmission( ) -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_push_updates(raop_client, playing_listener): await raop_client.stream.stream_file(data_path("only_metadata.wav")) @@ -277,7 +277,7 @@ async def test_push_updates(raop_client, playing_listener): assert idle.media_type == MediaType.Unknown -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_push_updates_progress(raop_client, playing_listener): assert_features_in_state( raop_client.features.all_features(), @@ -302,7 +302,7 @@ async def test_push_updates_progress(raop_client, playing_listener): ) -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_metadata_features(raop_client, playing_listener): # All features should be unavailable when nothing is playing assert_features_in_state( @@ -330,7 +330,7 @@ async def test_metadata_features(raop_client, playing_listener): ) -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_remote_control_features(raop_client, playing_listener): assert_features_in_state( raop_client.features.all_features(), @@ -361,7 +361,7 @@ async def test_remote_control_features(raop_client, playing_listener): ) -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_sync_packets(raop_client, raop_state): await raop_client.stream.stream_file(data_path("only_metadata.wav")) @@ -386,7 +386,7 @@ async def test_send_feedback(raop_client, raop_usecase, raop_state, feedback_sup assert raop_state.feedback_packets_received == 1 -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_set_volume_prior_to_streaming(raop_client, raop_state): # Initial client sound level assert math.isclose(raop_client.audio.volume, 33.0) @@ -430,7 +430,7 @@ async def test_use_default_volume_from_device( assert math.isclose(raop_client.audio.volume, sender_expected) -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_set_volume_during_playback(raop_client, raop_state, playing_listener): # Set maximum volume as initial volume await raop_client.audio.set_volume(100.0) @@ -451,7 +451,7 @@ async def test_set_volume_during_playback(raop_client, raop_state, playing_liste await future -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_volume_features(raop_client): assert_features_in_state( raop_client.features.all_features(), VOLUME_FIELDS, FeatureState.Available @@ -487,7 +487,7 @@ async def test_volume_up_volume_down(raop_client, iface): assert math.isclose(raop_client.audio.volume, 0.0) -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_only_allow_one_stream_at_the_time(raop_client): # This is not pretty, but the idea is to start two concurrent streaming tasks, wait # for them to finish and verify that one of them raised an exception. This is to @@ -504,7 +504,7 @@ async def test_only_allow_one_stream_at_the_time(raop_client): assert isinstance(result[0], exceptions.InvalidStateError) -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_muted_volume_from_receiver(raop_client, raop_state, raop_usecase): raop_usecase.initial_audio_level_supported(True) raop_state.volume = -144.0 @@ -514,7 +514,7 @@ async def test_muted_volume_from_receiver(raop_client, raop_state, raop_usecase) assert math.isclose(raop_client.audio.volume, 0.0) -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_mute_volume_from_client(raop_client, raop_state): await raop_client.audio.set_volume(0.0) @@ -523,7 +523,7 @@ async def test_mute_volume_from_client(raop_client, raop_state): assert math.isclose(raop_state.volume, -144.0) -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_device_not_supporting_info_requests(raop_client, raop_usecase): raop_usecase.supports_info(False) @@ -531,13 +531,13 @@ async def test_device_not_supporting_info_requests(raop_client, raop_usecase): await raop_client.stream.stream_file(data_path("only_metadata.wav")) -@pytest.mark.parametrize("raop_properties", [({"et": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0"}]) async def test_teardown_called_after_playback(raop_client, raop_state): await raop_client.stream.stream_file(data_path("only_metadata.wav")) assert raop_state.teardown_called -@pytest.mark.parametrize("raop_properties", [({"et": "0", "md": "0,1"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0", "md": "0,1"}]) async def test_custom_metadata(raop_client, raop_state): metadata = MediaMetadata(title="A", artist="B", album="C", artwork=b"abcd") @@ -552,7 +552,7 @@ async def test_custom_metadata(raop_client, raop_state): assert raop_state.metadata.artwork == "abcd" -@pytest.mark.parametrize("raop_properties", [({"et": "0", "md": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0", "md": "0"}]) async def test_custom_metadata_no_artwork(raop_client, raop_state): metadata = MediaMetadata(artwork=b"abcd") @@ -563,7 +563,7 @@ async def test_custom_metadata_no_artwork(raop_client, raop_state): assert raop_state.metadata.artwork is None -@pytest.mark.parametrize("raop_properties", [({"et": "0", "md": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0", "md": "0"}]) async def test_custom_metadata_override_missing(raop_client, raop_state): metadata = MediaMetadata(title="A", artist="B", album="C") @@ -576,7 +576,7 @@ async def test_custom_metadata_override_missing(raop_client, raop_state): assert raop_state.metadata.album == "C" -@pytest.mark.parametrize("raop_properties", [({"et": "0", "md": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0", "md": "0"}]) async def test_stream_from_buffer(raop_client, raop_state): with io.open(data_path("audio_1_packet_metadata.wav"), "rb") as source_file: await raop_client.stream.stream_file(source_file) @@ -627,7 +627,7 @@ async def test_stream_metadata_from_http( assert raop_state.metadata.title == "pyatv" -@pytest.mark.parametrize("raop_properties", [({"et": "0", "md": "0"})]) +@pytest.mark.parametrize("raop_properties", [{"et": "0", "md": "0"}]) async def test_stream_volume_set_after_stream_start( raop_client, raop_state, raop_usecase ): diff --git a/tests/support/test_dns.py b/tests/support/test_dns.py index 78d922726..03f3ccb47 100644 --- a/tests/support/test_dns.py +++ b/tests/support/test_dns.py @@ -100,16 +100,16 @@ def test_qname_encode(name, expected_raw): decode_domain_names = { "simple": (b"\x03foo\x07example\x03com\x00", 0, "foo.example.com", None), "null": (b"\00", 0, "", None), - "compressed": (b"aaaa\x04test\x00\x05label\xC0\x04\xAB\xCD", 10, "label.test", -2), + "compressed": (b"aaaa\x04test\x00\x05label\xc0\x04\xab\xcd", 10, "label.test", -2), # This case has two levels of compression "multi_compressed": ( - b"aaaa\x04test\x00\x05label\xC0\x04\x03foo\xC0\x0A\xAB\xCD", + b"aaaa\x04test\x00\x05label\xc0\x04\x03foo\xc0\x0a\xab\xcd", 18, "foo.label.test", -2, ), # Taken straight from the Internationalized Domain name Wikipedia page - "idna": (b"\x0Dxn--bcher-kva\x07example\x00", 0, "bücher.example", None), + "idna": (b"\x0dxn--bcher-kva\x07example\x00", 0, "bücher.example", None), # Taken from issue #919. Apple puts a non-breaking space between "Apple" and "TV". "nbsp": ( b"\x10Apple\xc2\xa0TV (4167)\x05local\x00", @@ -162,17 +162,17 @@ def test_domain_name_parsing( "null": (b"\x00", b"", None), # 63 is significant because that's the max length for a domain label, but not a # character-string (they have similar encodings). - "len_63": (b"\x3F" + (63 * b"0"), (63 * b"0"), None), + "len_63": (b"\x3f" + (63 * b"0"), (63 * b"0"), None), # For similar reasons as 63, 64 is significant because it would set only one of the # flag bits for name compression if domain-name encoding is assumed. "len_64": (b"\x40" + (64 * b"0"), (64 * b"0"), None), # Ditto for 128, but the other flag "len_128": (b"\x80" + (128 * b"0"), (128 * b"0"), None), # ...and 192 is both flags - "len_192": (b"\xC0" + (192 * b"0"), (192 * b"0"), None), + "len_192": (b"\xc0" + (192 * b"0"), (192 * b"0"), None), # 255 is the max length a character-string can be - "len_255": (b"\xFF" + (255 * b"0"), (255 * b"0"), None), - "trailing": (b"\x0A" + (10 * b"2") + (17 * b"9"), (10 * b"2"), -17), + "len_255": (b"\xff" + (255 * b"0"), (255 * b"0"), None), + "trailing": (b"\x0a" + (10 * b"2") + (17 * b"9"), (10 * b"2"), -17), } @@ -200,7 +200,7 @@ def test_string_parsing( def test_dns_sd_txt_parse_single(): """Test that a TXT RDATA section with one key can be parsed properly.""" data = b"\x07foo=bar" - extra_data = data + b"\xDE\xAD\xBE\xEF" * 3 + extra_data = data + b"\xde\xad\xbe\xef" * 3 with io.BytesIO(extra_data) as buffer: txt_dict = dns.parse_txt_dict(buffer, len(data)) assert buffer.tell() == len(data) @@ -210,7 +210,7 @@ def test_dns_sd_txt_parse_single(): def test_dns_sd_txt_parse_multiple(): """Test that a TXT RDATA section with multiple keys can be parsed properly.""" data = b"\x07foo=bar\x09spam=eggs" - extra_data = data + b"\xDE\xAD\xBE\xEF" * 2 + extra_data = data + b"\xde\xad\xbe\xef" * 2 with io.BytesIO(extra_data) as buffer: txt_dict = dns.parse_txt_dict(buffer, len(data)) assert buffer.tell() == len(data) @@ -221,24 +221,24 @@ def test_dns_sd_txt_parse_binary(): """Test that a TXT RDATA section with a binary value can be parsed properly.""" # 0xfeed can't be decoded as UTF-8 or ASCII, so it'll thrown an error if it's not # being treated as binary data. - data = b"\x06foo=\xFE\xED" - extra_data = data + b"\xDE\xAD\xBE\xEF" * 3 + data = b"\x06foo=\xfe\xed" + extra_data = data + b"\xde\xad\xbe\xef" * 3 with io.BytesIO(extra_data) as buffer: txt_dict = dns.parse_txt_dict(buffer, len(data)) assert buffer.tell() == len(data) - assert txt_dict == {"foo": b"\xFE\xED"} + assert txt_dict == {"foo": b"\xfe\xed"} def test_dns_sd_txt_parse_long(): """Test that a TXT RDATA section with a long value can be parsed properly.""" # If TXT records are being parsed the same way domain names are, this won't work as # the data is too long to fit in a label. - data = b"\xCCfoo=" + b"\xCA\xFE" * 100 - extra_data = data + b"\xDE\xAD\xBE\xEF" * 3 + data = b"\xccfoo=" + b"\xca\xfe" * 100 + extra_data = data + b"\xde\xad\xbe\xef" * 3 with io.BytesIO(extra_data) as buffer: txt_dict = dns.parse_txt_dict(buffer, len(data)) assert buffer.tell() == len(data) - assert txt_dict == {"foo": b"\xCA\xFE" * 100} + assert txt_dict == {"foo": b"\xca\xfe" * 100} @pytest.mark.parametrize( @@ -256,12 +256,12 @@ def test_dns_sd_txt_format(data, expected): @pytest.mark.parametrize( "record_type,data,expected", [ - (dns.QueryType.A, b"\x0A\x00\x00\x2A", "10.0.0.42"), + (dns.QueryType.A, b"\x0a\x00\x00\x2a", "10.0.0.42"), (dns.QueryType.PTR, b"\x03foo\x07example\x03com\x00", "foo.example.com"), (dns.QueryType.TXT, b"\x07foo=bar", {"foo": b"bar"}), ( dns.QueryType.SRV, - b"\x00\x0A\x00\x00\x00\x50\x03foo\x07example\x03com\x00", + b"\x00\x0a\x00\x00\x00\x50\x03foo\x07example\x03com\x00", { "priority": 10, "weight": 0, diff --git a/tests/support/test_opack.py b/tests/support/test_opack.py index 6ffe6b6be..22b94e5ca 100644 --- a/tests/support/test_opack.py +++ b/tests/support/test_opack.py @@ -43,14 +43,14 @@ def test_pack_absolute_time(): def test_pack_small_integers(): assert pack(0) == b"\x08" assert pack(0xF) == b"\x17" - assert pack(0x27) == b"\x2F" + assert pack(0x27) == b"\x2f" def test_pack_larger_integers(): assert pack(0x28) == b"\x30\x28" - assert pack(0x1FF) == b"\x31\xFF\x01" - assert pack(0x1FFFFFF) == b"\x32\xFF\xFF\xFF\x01" - assert pack(0x1FFFFFFFFFFFFFF) == b"\x33\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01" + assert pack(0x1FF) == b"\x31\xff\x01" + assert pack(0x1FFFFFF) == b"\x32\xff\xff\xff\x01" + assert pack(0x1FFFFFFFFFFFFFF) == b"\x33\xff\xff\xff\xff\xff\xff\xff\x01" def test_pack_sized_integers(): @@ -61,7 +61,7 @@ def test_pack_sized_integers(): def test_pack_float64(): - assert pack(1.0) == b"\x36\x00\x00\x00\x00\x00\x00\xF0\x3F" + assert pack(1.0) == b"\x36\x00\x00\x00\x00\x00\x00\xf0\x3f" def test_pack_short_strings(): @@ -94,7 +94,7 @@ def test_pack_array(): def test_pack_endless_array(): - assert pack(15 * ["a"]) == b"\xDF\x41\x61" + 14 * b"\xa0" + b"\x03" + assert pack(15 * ["a"]) == b"\xdf\x41\x61" + 14 * b"\xa0" + b"\x03" def test_pack_dict(): @@ -105,19 +105,19 @@ def test_pack_dict(): def test_pack_endless_dict(): assert pack(dict((chr(x), chr(x + 1)) for x in range(97, 127, 2))) == ( - b"\xEF" + b"\x41" + b"\x41".join(bytes([x]) for x in range(97, 127)) + b"\x03" + b"\xef" + b"\x41" + b"\x41".join(bytes([x]) for x in range(97, 127)) + b"\x03" ) def test_pack_ptr(): - assert pack(["a", "a"]) == b"\xD2\x41\x61\xA0" + assert pack(["a", "a"]) == b"\xd2\x41\x61\xa0" assert ( pack(["foo", "bar", "foo", "bar"]) - == b"\xD4\x43\x66\x6F\x6F\x43\x62\x61\x72\xA0\xA1" + == b"\xd4\x43\x66\x6f\x6f\x43\x62\x61\x72\xa0\xa1" ) assert ( pack({"a": "b", "c": {"d": "a"}, "d": True}) - == b"\xE3\x41\x61\x41\x62\x41\x63\xE1\x41\x64\xA0\xA3\x01" + == b"\xe3\x41\x61\x41\x62\x41\x63\xe1\x41\x64\xa0\xa3\x01" ) @@ -125,77 +125,77 @@ def test_pack_more_ptr(): data = list(chr(x).encode() for x in range(257)) assert ( pack(data + data) - == b"\xDF\x71\x00\x71\x01\x71\x02\x71\x03\x71\x04\x71\x05\x71\x06\x71" - b"\x07\x71\x08\x71\x09\x71\x0A\x71\x0B\x71\x0C\x71\x0D\x71\x0E\x71" - b"\x0F\x71\x10\x71\x11\x71\x12\x71\x13\x71\x14\x71\x15\x71\x16\x71" - b"\x17\x71\x18\x71\x19\x71\x1A\x71\x1B\x71\x1C\x71\x1D\x71\x1E\x71" - b"\x1F\x71\x20\x71\x21\x71\x22\x71\x23\x71\x24\x71\x25\x71\x26\x71" - b"\x27\x71\x28\x71\x29\x71\x2A\x71\x2B\x71\x2C\x71\x2D\x71\x2E\x71" - b"\x2F\x71\x30\x71\x31\x71\x32\x71\x33\x71\x34\x71\x35\x71\x36\x71" - b"\x37\x71\x38\x71\x39\x71\x3A\x71\x3B\x71\x3C\x71\x3D\x71\x3E\x71" - b"\x3F\x71\x40\x71\x41\x71\x42\x71\x43\x71\x44\x71\x45\x71\x46\x71" - b"\x47\x71\x48\x71\x49\x71\x4A\x71\x4B\x71\x4C\x71\x4D\x71\x4E\x71" - b"\x4F\x71\x50\x71\x51\x71\x52\x71\x53\x71\x54\x71\x55\x71\x56\x71" - b"\x57\x71\x58\x71\x59\x71\x5A\x71\x5B\x71\x5C\x71\x5D\x71\x5E\x71" - b"\x5F\x71\x60\x71\x61\x71\x62\x71\x63\x71\x64\x71\x65\x71\x66\x71" - b"\x67\x71\x68\x71\x69\x71\x6A\x71\x6B\x71\x6C\x71\x6D\x71\x6E\x71" - b"\x6F\x71\x70\x71\x71\x71\x72\x71\x73\x71\x74\x71\x75\x71\x76\x71" - b"\x77\x71\x78\x71\x79\x71\x7A\x71\x7B\x71\x7C\x71\x7D\x71\x7E\x71" - b"\x7F\x72\xC2\x80\x72\xC2\x81\x72\xC2\x82\x72\xC2\x83\x72\xC2\x84" - b"\x72\xC2\x85\x72\xC2\x86\x72\xC2\x87\x72\xC2\x88\x72\xC2\x89\x72" - b"\xC2\x8A\x72\xC2\x8B\x72\xC2\x8C\x72\xC2\x8D\x72\xC2\x8E\x72\xC2" - b"\x8F\x72\xC2\x90\x72\xC2\x91\x72\xC2\x92\x72\xC2\x93\x72\xC2\x94" - b"\x72\xC2\x95\x72\xC2\x96\x72\xC2\x97\x72\xC2\x98\x72\xC2\x99\x72" - b"\xC2\x9A\x72\xC2\x9B\x72\xC2\x9C\x72\xC2\x9D\x72\xC2\x9E\x72\xC2" - b"\x9F\x72\xC2\xA0\x72\xC2\xA1\x72\xC2\xA2\x72\xC2\xA3\x72\xC2\xA4" - b"\x72\xC2\xA5\x72\xC2\xA6\x72\xC2\xA7\x72\xC2\xA8\x72\xC2\xA9\x72" - b"\xC2\xAA\x72\xC2\xAB\x72\xC2\xAC\x72\xC2\xAD\x72\xC2\xAE\x72\xC2" - b"\xAF\x72\xC2\xB0\x72\xC2\xB1\x72\xC2\xB2\x72\xC2\xB3\x72\xC2\xB4" - b"\x72\xC2\xB5\x72\xC2\xB6\x72\xC2\xB7\x72\xC2\xB8\x72\xC2\xB9\x72" - b"\xC2\xBA\x72\xC2\xBB\x72\xC2\xBC\x72\xC2\xBD\x72\xC2\xBE\x72\xC2" - b"\xBF\x72\xC3\x80\x72\xC3\x81\x72\xC3\x82\x72\xC3\x83\x72\xC3\x84" - b"\x72\xC3\x85\x72\xC3\x86\x72\xC3\x87\x72\xC3\x88\x72\xC3\x89\x72" - b"\xC3\x8A\x72\xC3\x8B\x72\xC3\x8C\x72\xC3\x8D\x72\xC3\x8E\x72\xC3" - b"\x8F\x72\xC3\x90\x72\xC3\x91\x72\xC3\x92\x72\xC3\x93\x72\xC3\x94" - b"\x72\xC3\x95\x72\xC3\x96\x72\xC3\x97\x72\xC3\x98\x72\xC3\x99\x72" - b"\xC3\x9A\x72\xC3\x9B\x72\xC3\x9C\x72\xC3\x9D\x72\xC3\x9E\x72\xC3" - b"\x9F\x72\xC3\xA0\x72\xC3\xA1\x72\xC3\xA2\x72\xC3\xA3\x72\xC3\xA4" - b"\x72\xC3\xA5\x72\xC3\xA6\x72\xC3\xA7\x72\xC3\xA8\x72\xC3\xA9\x72" - b"\xC3\xAA\x72\xC3\xAB\x72\xC3\xAC\x72\xC3\xAD\x72\xC3\xAE\x72\xC3" - b"\xAF\x72\xC3\xB0\x72\xC3\xB1\x72\xC3\xB2\x72\xC3\xB3\x72\xC3\xB4" - b"\x72\xC3\xB5\x72\xC3\xB6\x72\xC3\xB7\x72\xC3\xB8\x72\xC3\xB9\x72" - b"\xC3\xBA\x72\xC3\xBB\x72\xC3\xBC\x72\xC3\xBD\x72\xC3\xBE\x72\xC3" - b"\xBF\x72\xC4\x80\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB" - b"\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB" - b"\xBC\xBD\xBE\xBF\xC0\xC1\x21\xC1\x22\xC1\x23\xC1\x24\xC1\x25\xC1" - b"\x26\xC1\x27\xC1\x28\xC1\x29\xC1\x2A\xC1\x2B\xC1\x2C\xC1\x2D\xC1" - b"\x2E\xC1\x2F\xC1\x30\xC1\x31\xC1\x32\xC1\x33\xC1\x34\xC1\x35\xC1" - b"\x36\xC1\x37\xC1\x38\xC1\x39\xC1\x3A\xC1\x3B\xC1\x3C\xC1\x3D\xC1" - b"\x3E\xC1\x3F\xC1\x40\xC1\x41\xC1\x42\xC1\x43\xC1\x44\xC1\x45\xC1" - b"\x46\xC1\x47\xC1\x48\xC1\x49\xC1\x4A\xC1\x4B\xC1\x4C\xC1\x4D\xC1" - b"\x4E\xC1\x4F\xC1\x50\xC1\x51\xC1\x52\xC1\x53\xC1\x54\xC1\x55\xC1" - b"\x56\xC1\x57\xC1\x58\xC1\x59\xC1\x5A\xC1\x5B\xC1\x5C\xC1\x5D\xC1" - b"\x5E\xC1\x5F\xC1\x60\xC1\x61\xC1\x62\xC1\x63\xC1\x64\xC1\x65\xC1" - b"\x66\xC1\x67\xC1\x68\xC1\x69\xC1\x6A\xC1\x6B\xC1\x6C\xC1\x6D\xC1" - b"\x6E\xC1\x6F\xC1\x70\xC1\x71\xC1\x72\xC1\x73\xC1\x74\xC1\x75\xC1" - b"\x76\xC1\x77\xC1\x78\xC1\x79\xC1\x7A\xC1\x7B\xC1\x7C\xC1\x7D\xC1" - b"\x7E\xC1\x7F\xC1\x80\xC1\x81\xC1\x82\xC1\x83\xC1\x84\xC1\x85\xC1" - b"\x86\xC1\x87\xC1\x88\xC1\x89\xC1\x8A\xC1\x8B\xC1\x8C\xC1\x8D\xC1" - b"\x8E\xC1\x8F\xC1\x90\xC1\x91\xC1\x92\xC1\x93\xC1\x94\xC1\x95\xC1" - b"\x96\xC1\x97\xC1\x98\xC1\x99\xC1\x9A\xC1\x9B\xC1\x9C\xC1\x9D\xC1" - b"\x9E\xC1\x9F\xC1\xA0\xC1\xA1\xC1\xA2\xC1\xA3\xC1\xA4\xC1\xA5\xC1" - b"\xA6\xC1\xA7\xC1\xA8\xC1\xA9\xC1\xAA\xC1\xAB\xC1\xAC\xC1\xAD\xC1" - b"\xAE\xC1\xAF\xC1\xB0\xC1\xB1\xC1\xB2\xC1\xB3\xC1\xB4\xC1\xB5\xC1" - b"\xB6\xC1\xB7\xC1\xB8\xC1\xB9\xC1\xBA\xC1\xBB\xC1\xBC\xC1\xBD\xC1" - b"\xBE\xC1\xBF\xC1\xC0\xC1\xC1\xC1\xC2\xC1\xC3\xC1\xC4\xC1\xC5\xC1" - b"\xC6\xC1\xC7\xC1\xC8\xC1\xC9\xC1\xCA\xC1\xCB\xC1\xCC\xC1\xCD\xC1" - b"\xCE\xC1\xCF\xC1\xD0\xC1\xD1\xC1\xD2\xC1\xD3\xC1\xD4\xC1\xD5\xC1" - b"\xD6\xC1\xD7\xC1\xD8\xC1\xD9\xC1\xDA\xC1\xDB\xC1\xDC\xC1\xDD\xC1" - b"\xDE\xC1\xDF\xC1\xE0\xC1\xE1\xC1\xE2\xC1\xE3\xC1\xE4\xC1\xE5\xC1" - b"\xE6\xC1\xE7\xC1\xE8\xC1\xE9\xC1\xEA\xC1\xEB\xC1\xEC\xC1\xED\xC1" - b"\xEE\xC1\xEF\xC1\xF0\xC1\xF1\xC1\xF2\xC1\xF3\xC1\xF4\xC1\xF5\xC1" - b"\xF6\xC1\xF7\xC1\xF8\xC1\xF9\xC1\xFA\xC1\xFB\xC1\xFC\xC1\xFD\xC1" - b"\xFE\xC1\xFF\xC2\x00\x01\x03" + == b"\xdf\x71\x00\x71\x01\x71\x02\x71\x03\x71\x04\x71\x05\x71\x06\x71" + b"\x07\x71\x08\x71\x09\x71\x0a\x71\x0b\x71\x0c\x71\x0d\x71\x0e\x71" + b"\x0f\x71\x10\x71\x11\x71\x12\x71\x13\x71\x14\x71\x15\x71\x16\x71" + b"\x17\x71\x18\x71\x19\x71\x1a\x71\x1b\x71\x1c\x71\x1d\x71\x1e\x71" + b"\x1f\x71\x20\x71\x21\x71\x22\x71\x23\x71\x24\x71\x25\x71\x26\x71" + b"\x27\x71\x28\x71\x29\x71\x2a\x71\x2b\x71\x2c\x71\x2d\x71\x2e\x71" + b"\x2f\x71\x30\x71\x31\x71\x32\x71\x33\x71\x34\x71\x35\x71\x36\x71" + b"\x37\x71\x38\x71\x39\x71\x3a\x71\x3b\x71\x3c\x71\x3d\x71\x3e\x71" + b"\x3f\x71\x40\x71\x41\x71\x42\x71\x43\x71\x44\x71\x45\x71\x46\x71" + b"\x47\x71\x48\x71\x49\x71\x4a\x71\x4b\x71\x4c\x71\x4d\x71\x4e\x71" + b"\x4f\x71\x50\x71\x51\x71\x52\x71\x53\x71\x54\x71\x55\x71\x56\x71" + b"\x57\x71\x58\x71\x59\x71\x5a\x71\x5b\x71\x5c\x71\x5d\x71\x5e\x71" + b"\x5f\x71\x60\x71\x61\x71\x62\x71\x63\x71\x64\x71\x65\x71\x66\x71" + b"\x67\x71\x68\x71\x69\x71\x6a\x71\x6b\x71\x6c\x71\x6d\x71\x6e\x71" + b"\x6f\x71\x70\x71\x71\x71\x72\x71\x73\x71\x74\x71\x75\x71\x76\x71" + b"\x77\x71\x78\x71\x79\x71\x7a\x71\x7b\x71\x7c\x71\x7d\x71\x7e\x71" + b"\x7f\x72\xc2\x80\x72\xc2\x81\x72\xc2\x82\x72\xc2\x83\x72\xc2\x84" + b"\x72\xc2\x85\x72\xc2\x86\x72\xc2\x87\x72\xc2\x88\x72\xc2\x89\x72" + b"\xc2\x8a\x72\xc2\x8b\x72\xc2\x8c\x72\xc2\x8d\x72\xc2\x8e\x72\xc2" + b"\x8f\x72\xc2\x90\x72\xc2\x91\x72\xc2\x92\x72\xc2\x93\x72\xc2\x94" + b"\x72\xc2\x95\x72\xc2\x96\x72\xc2\x97\x72\xc2\x98\x72\xc2\x99\x72" + b"\xc2\x9a\x72\xc2\x9b\x72\xc2\x9c\x72\xc2\x9d\x72\xc2\x9e\x72\xc2" + b"\x9f\x72\xc2\xa0\x72\xc2\xa1\x72\xc2\xa2\x72\xc2\xa3\x72\xc2\xa4" + b"\x72\xc2\xa5\x72\xc2\xa6\x72\xc2\xa7\x72\xc2\xa8\x72\xc2\xa9\x72" + b"\xc2\xaa\x72\xc2\xab\x72\xc2\xac\x72\xc2\xad\x72\xc2\xae\x72\xc2" + b"\xaf\x72\xc2\xb0\x72\xc2\xb1\x72\xc2\xb2\x72\xc2\xb3\x72\xc2\xb4" + b"\x72\xc2\xb5\x72\xc2\xb6\x72\xc2\xb7\x72\xc2\xb8\x72\xc2\xb9\x72" + b"\xc2\xba\x72\xc2\xbb\x72\xc2\xbc\x72\xc2\xbd\x72\xc2\xbe\x72\xc2" + b"\xbf\x72\xc3\x80\x72\xc3\x81\x72\xc3\x82\x72\xc3\x83\x72\xc3\x84" + b"\x72\xc3\x85\x72\xc3\x86\x72\xc3\x87\x72\xc3\x88\x72\xc3\x89\x72" + b"\xc3\x8a\x72\xc3\x8b\x72\xc3\x8c\x72\xc3\x8d\x72\xc3\x8e\x72\xc3" + b"\x8f\x72\xc3\x90\x72\xc3\x91\x72\xc3\x92\x72\xc3\x93\x72\xc3\x94" + b"\x72\xc3\x95\x72\xc3\x96\x72\xc3\x97\x72\xc3\x98\x72\xc3\x99\x72" + b"\xc3\x9a\x72\xc3\x9b\x72\xc3\x9c\x72\xc3\x9d\x72\xc3\x9e\x72\xc3" + b"\x9f\x72\xc3\xa0\x72\xc3\xa1\x72\xc3\xa2\x72\xc3\xa3\x72\xc3\xa4" + b"\x72\xc3\xa5\x72\xc3\xa6\x72\xc3\xa7\x72\xc3\xa8\x72\xc3\xa9\x72" + b"\xc3\xaa\x72\xc3\xab\x72\xc3\xac\x72\xc3\xad\x72\xc3\xae\x72\xc3" + b"\xaf\x72\xc3\xb0\x72\xc3\xb1\x72\xc3\xb2\x72\xc3\xb3\x72\xc3\xb4" + b"\x72\xc3\xb5\x72\xc3\xb6\x72\xc3\xb7\x72\xc3\xb8\x72\xc3\xb9\x72" + b"\xc3\xba\x72\xc3\xbb\x72\xc3\xbc\x72\xc3\xbd\x72\xc3\xbe\x72\xc3" + b"\xbf\x72\xc4\x80\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab" + b"\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb" + b"\xbc\xbd\xbe\xbf\xc0\xc1\x21\xc1\x22\xc1\x23\xc1\x24\xc1\x25\xc1" + b"\x26\xc1\x27\xc1\x28\xc1\x29\xc1\x2a\xc1\x2b\xc1\x2c\xc1\x2d\xc1" + b"\x2e\xc1\x2f\xc1\x30\xc1\x31\xc1\x32\xc1\x33\xc1\x34\xc1\x35\xc1" + b"\x36\xc1\x37\xc1\x38\xc1\x39\xc1\x3a\xc1\x3b\xc1\x3c\xc1\x3d\xc1" + b"\x3e\xc1\x3f\xc1\x40\xc1\x41\xc1\x42\xc1\x43\xc1\x44\xc1\x45\xc1" + b"\x46\xc1\x47\xc1\x48\xc1\x49\xc1\x4a\xc1\x4b\xc1\x4c\xc1\x4d\xc1" + b"\x4e\xc1\x4f\xc1\x50\xc1\x51\xc1\x52\xc1\x53\xc1\x54\xc1\x55\xc1" + b"\x56\xc1\x57\xc1\x58\xc1\x59\xc1\x5a\xc1\x5b\xc1\x5c\xc1\x5d\xc1" + b"\x5e\xc1\x5f\xc1\x60\xc1\x61\xc1\x62\xc1\x63\xc1\x64\xc1\x65\xc1" + b"\x66\xc1\x67\xc1\x68\xc1\x69\xc1\x6a\xc1\x6b\xc1\x6c\xc1\x6d\xc1" + b"\x6e\xc1\x6f\xc1\x70\xc1\x71\xc1\x72\xc1\x73\xc1\x74\xc1\x75\xc1" + b"\x76\xc1\x77\xc1\x78\xc1\x79\xc1\x7a\xc1\x7b\xc1\x7c\xc1\x7d\xc1" + b"\x7e\xc1\x7f\xc1\x80\xc1\x81\xc1\x82\xc1\x83\xc1\x84\xc1\x85\xc1" + b"\x86\xc1\x87\xc1\x88\xc1\x89\xc1\x8a\xc1\x8b\xc1\x8c\xc1\x8d\xc1" + b"\x8e\xc1\x8f\xc1\x90\xc1\x91\xc1\x92\xc1\x93\xc1\x94\xc1\x95\xc1" + b"\x96\xc1\x97\xc1\x98\xc1\x99\xc1\x9a\xc1\x9b\xc1\x9c\xc1\x9d\xc1" + b"\x9e\xc1\x9f\xc1\xa0\xc1\xa1\xc1\xa2\xc1\xa3\xc1\xa4\xc1\xa5\xc1" + b"\xa6\xc1\xa7\xc1\xa8\xc1\xa9\xc1\xaa\xc1\xab\xc1\xac\xc1\xad\xc1" + b"\xae\xc1\xaf\xc1\xb0\xc1\xb1\xc1\xb2\xc1\xb3\xc1\xb4\xc1\xb5\xc1" + b"\xb6\xc1\xb7\xc1\xb8\xc1\xb9\xc1\xba\xc1\xbb\xc1\xbc\xc1\xbd\xc1" + b"\xbe\xc1\xbf\xc1\xc0\xc1\xc1\xc1\xc2\xc1\xc3\xc1\xc4\xc1\xc5\xc1" + b"\xc6\xc1\xc7\xc1\xc8\xc1\xc9\xc1\xca\xc1\xcb\xc1\xcc\xc1\xcd\xc1" + b"\xce\xc1\xcf\xc1\xd0\xc1\xd1\xc1\xd2\xc1\xd3\xc1\xd4\xc1\xd5\xc1" + b"\xd6\xc1\xd7\xc1\xd8\xc1\xd9\xc1\xda\xc1\xdb\xc1\xdc\xc1\xdd\xc1" + b"\xde\xc1\xdf\xc1\xe0\xc1\xe1\xc1\xe2\xc1\xe3\xc1\xe4\xc1\xe5\xc1" + b"\xe6\xc1\xe7\xc1\xe8\xc1\xe9\xc1\xea\xc1\xeb\xc1\xec\xc1\xed\xc1" + b"\xee\xc1\xef\xc1\xf0\xc1\xf1\xc1\xf2\xc1\xf3\xc1\xf4\xc1\xf5\xc1" + b"\xf6\xc1\xf7\xc1\xf8\xc1\xf9\xc1\xfa\xc1\xfb\xc1\xfc\xc1\xfd\xc1" + b"\xfe\xc1\xff\xc2\x00\x01\x03" ) @@ -231,14 +231,14 @@ def test_unpack_absolute_time(): def test_unpack_small_integers(): assert unpack(b"\x08") == (0, b"") assert unpack(b"\x17") == (0xF, b"") - assert unpack(b"\x2F") == (0x27, b"") + assert unpack(b"\x2f") == (0x27, b"") def test_unpack_larger_integers(): assert unpack(b"\x30\x28") == (0x28, b"") - assert unpack(b"\x31\xFF\x01") == (0x1FF, b"") - assert unpack(b"\x32\xFF\xFF\xFF\x01") == (0x1FFFFFF, b"") - assert unpack(b"\x33\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01") == (0x1FFFFFFFFFFFFFF, b"") + assert unpack(b"\x31\xff\x01") == (0x1FF, b"") + assert unpack(b"\x32\xff\xff\xff\x01") == (0x1FFFFFF, b"") + assert unpack(b"\x33\xff\xff\xff\xff\xff\xff\xff\x01") == (0x1FFFFFFFFFFFFFF, b"") def test_unpack_sized_integers(): @@ -253,7 +253,7 @@ def test_pack_unfloat32(): def test_unpack_float64(): - assert unpack(b"\x36\x00\x00\x00\x00\x00\x00\xF0\x3F") == (1.0, b"") + assert unpack(b"\x36\x00\x00\x00\x00\x00\x00\xf0\x3f") == (1.0, b"") def test_unpack_short_strings(): @@ -286,10 +286,10 @@ def test_unpack_array(): def test_unpack_endless_array(): - list1 = b"\xDF\x41\x61" + 15 * b"\xa0" + b"\x03" - list2 = b"\xDF\x41\x62" + 15 * b"\xa1" + b"\x03" + list1 = b"\xdf\x41\x61" + 15 * b"\xa0" + b"\x03" + list2 = b"\xdf\x41\x62" + 15 * b"\xa1" + b"\x03" assert unpack(list1) == (16 * ["a"], b"") - assert unpack(b"\xD2" + list1 + list2) == ([16 * ["a"], 16 * ["b"]], b"") + assert unpack(b"\xd2" + list1 + list2) == ([16 * ["a"], 16 * ["b"]], b"") def test_unpack_dict(): @@ -300,17 +300,17 @@ def test_unpack_dict(): def test_unpack_endless_dict(): assert unpack( - b"\xEF" + b"\x41" + b"\x41".join(bytes([x]) for x in range(97, 127)) + b"\x03" + b"\xef" + b"\x41" + b"\x41".join(bytes([x]) for x in range(97, 127)) + b"\x03" ) == (dict((chr(x), chr(x + 1)) for x in range(97, 127, 2)), b"") def test_unpack_ptr(): - assert unpack(b"\xD2\x41\x61\xA0") == (["a", "a"], b"") - assert unpack(b"\xD4\x43\x66\x6F\x6F\x43\x62\x61\x72\xA0\xA1") == ( + assert unpack(b"\xd2\x41\x61\xa0") == (["a", "a"], b"") + assert unpack(b"\xd4\x43\x66\x6f\x6f\x43\x62\x61\x72\xa0\xa1") == ( ["foo", "bar", "foo", "bar"], b"", ) - assert unpack(b"\xE3\x41\x61\x41\x62\x41\x63\xE1\x41\x64\xA0\xA3\x01") == ( + assert unpack(b"\xe3\x41\x61\x41\x62\x41\x63\xe1\x41\x64\xa0\xa3\x01") == ( {"a": "b", "c": {"d": "a"}, "d": True}, b"", ) @@ -319,85 +319,85 @@ def test_unpack_ptr(): def test_unpack_more_ptr(): data = list(chr(x).encode() for x in range(257)) assert unpack( - b"\xDF\x71\x00\x71\x01\x71\x02\x71\x03\x71\x04\x71\x05\x71\x06\x71" - b"\x07\x71\x08\x71\x09\x71\x0A\x71\x0B\x71\x0C\x71\x0D\x71\x0E\x71" - b"\x0F\x71\x10\x71\x11\x71\x12\x71\x13\x71\x14\x71\x15\x71\x16\x71" - b"\x17\x71\x18\x71\x19\x71\x1A\x71\x1B\x71\x1C\x71\x1D\x71\x1E\x71" - b"\x1F\x71\x20\x71\x21\x71\x22\x71\x23\x71\x24\x71\x25\x71\x26\x71" - b"\x27\x71\x28\x71\x29\x71\x2A\x71\x2B\x71\x2C\x71\x2D\x71\x2E\x71" - b"\x2F\x71\x30\x71\x31\x71\x32\x71\x33\x71\x34\x71\x35\x71\x36\x71" - b"\x37\x71\x38\x71\x39\x71\x3A\x71\x3B\x71\x3C\x71\x3D\x71\x3E\x71" - b"\x3F\x71\x40\x71\x41\x71\x42\x71\x43\x71\x44\x71\x45\x71\x46\x71" - b"\x47\x71\x48\x71\x49\x71\x4A\x71\x4B\x71\x4C\x71\x4D\x71\x4E\x71" - b"\x4F\x71\x50\x71\x51\x71\x52\x71\x53\x71\x54\x71\x55\x71\x56\x71" - b"\x57\x71\x58\x71\x59\x71\x5A\x71\x5B\x71\x5C\x71\x5D\x71\x5E\x71" - b"\x5F\x71\x60\x71\x61\x71\x62\x71\x63\x71\x64\x71\x65\x71\x66\x71" - b"\x67\x71\x68\x71\x69\x71\x6A\x71\x6B\x71\x6C\x71\x6D\x71\x6E\x71" - b"\x6F\x71\x70\x71\x71\x71\x72\x71\x73\x71\x74\x71\x75\x71\x76\x71" - b"\x77\x71\x78\x71\x79\x71\x7A\x71\x7B\x71\x7C\x71\x7D\x71\x7E\x71" - b"\x7F\x72\xC2\x80\x72\xC2\x81\x72\xC2\x82\x72\xC2\x83\x72\xC2\x84" - b"\x72\xC2\x85\x72\xC2\x86\x72\xC2\x87\x72\xC2\x88\x72\xC2\x89\x72" - b"\xC2\x8A\x72\xC2\x8B\x72\xC2\x8C\x72\xC2\x8D\x72\xC2\x8E\x72\xC2" - b"\x8F\x72\xC2\x90\x72\xC2\x91\x72\xC2\x92\x72\xC2\x93\x72\xC2\x94" - b"\x72\xC2\x95\x72\xC2\x96\x72\xC2\x97\x72\xC2\x98\x72\xC2\x99\x72" - b"\xC2\x9A\x72\xC2\x9B\x72\xC2\x9C\x72\xC2\x9D\x72\xC2\x9E\x72\xC2" - b"\x9F\x72\xC2\xA0\x72\xC2\xA1\x72\xC2\xA2\x72\xC2\xA3\x72\xC2\xA4" - b"\x72\xC2\xA5\x72\xC2\xA6\x72\xC2\xA7\x72\xC2\xA8\x72\xC2\xA9\x72" - b"\xC2\xAA\x72\xC2\xAB\x72\xC2\xAC\x72\xC2\xAD\x72\xC2\xAE\x72\xC2" - b"\xAF\x72\xC2\xB0\x72\xC2\xB1\x72\xC2\xB2\x72\xC2\xB3\x72\xC2\xB4" - b"\x72\xC2\xB5\x72\xC2\xB6\x72\xC2\xB7\x72\xC2\xB8\x72\xC2\xB9\x72" - b"\xC2\xBA\x72\xC2\xBB\x72\xC2\xBC\x72\xC2\xBD\x72\xC2\xBE\x72\xC2" - b"\xBF\x72\xC3\x80\x72\xC3\x81\x72\xC3\x82\x72\xC3\x83\x72\xC3\x84" - b"\x72\xC3\x85\x72\xC3\x86\x72\xC3\x87\x72\xC3\x88\x72\xC3\x89\x72" - b"\xC3\x8A\x72\xC3\x8B\x72\xC3\x8C\x72\xC3\x8D\x72\xC3\x8E\x72\xC3" - b"\x8F\x72\xC3\x90\x72\xC3\x91\x72\xC3\x92\x72\xC3\x93\x72\xC3\x94" - b"\x72\xC3\x95\x72\xC3\x96\x72\xC3\x97\x72\xC3\x98\x72\xC3\x99\x72" - b"\xC3\x9A\x72\xC3\x9B\x72\xC3\x9C\x72\xC3\x9D\x72\xC3\x9E\x72\xC3" - b"\x9F\x72\xC3\xA0\x72\xC3\xA1\x72\xC3\xA2\x72\xC3\xA3\x72\xC3\xA4" - b"\x72\xC3\xA5\x72\xC3\xA6\x72\xC3\xA7\x72\xC3\xA8\x72\xC3\xA9\x72" - b"\xC3\xAA\x72\xC3\xAB\x72\xC3\xAC\x72\xC3\xAD\x72\xC3\xAE\x72\xC3" - b"\xAF\x72\xC3\xB0\x72\xC3\xB1\x72\xC3\xB2\x72\xC3\xB3\x72\xC3\xB4" - b"\x72\xC3\xB5\x72\xC3\xB6\x72\xC3\xB7\x72\xC3\xB8\x72\xC3\xB9\x72" - b"\xC3\xBA\x72\xC3\xBB\x72\xC3\xBC\x72\xC3\xBD\x72\xC3\xBE\x72\xC3" - b"\xBF\x72\xC4\x80\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB" - b"\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB" - b"\xBC\xBD\xBE\xBF\xC0\xC1\x21\xC1\x22\xC1\x23\xC1\x24\xC1\x25\xC1" - b"\x26\xC1\x27\xC1\x28\xC1\x29\xC1\x2A\xC1\x2B\xC1\x2C\xC1\x2D\xC1" - b"\x2E\xC1\x2F\xC1\x30\xC1\x31\xC1\x32\xC1\x33\xC1\x34\xC1\x35\xC1" - b"\x36\xC1\x37\xC1\x38\xC1\x39\xC1\x3A\xC1\x3B\xC1\x3C\xC1\x3D\xC1" - b"\x3E\xC1\x3F\xC1\x40\xC1\x41\xC1\x42\xC1\x43\xC1\x44\xC1\x45\xC1" - b"\x46\xC1\x47\xC1\x48\xC1\x49\xC1\x4A\xC1\x4B\xC1\x4C\xC1\x4D\xC1" - b"\x4E\xC1\x4F\xC1\x50\xC1\x51\xC1\x52\xC1\x53\xC1\x54\xC1\x55\xC1" - b"\x56\xC1\x57\xC1\x58\xC1\x59\xC1\x5A\xC1\x5B\xC1\x5C\xC1\x5D\xC1" - b"\x5E\xC1\x5F\xC1\x60\xC1\x61\xC1\x62\xC1\x63\xC1\x64\xC1\x65\xC1" - b"\x66\xC1\x67\xC1\x68\xC1\x69\xC1\x6A\xC1\x6B\xC1\x6C\xC1\x6D\xC1" - b"\x6E\xC1\x6F\xC1\x70\xC1\x71\xC1\x72\xC1\x73\xC1\x74\xC1\x75\xC1" - b"\x76\xC1\x77\xC1\x78\xC1\x79\xC1\x7A\xC1\x7B\xC1\x7C\xC1\x7D\xC1" - b"\x7E\xC1\x7F\xC1\x80\xC1\x81\xC1\x82\xC1\x83\xC1\x84\xC1\x85\xC1" - b"\x86\xC1\x87\xC1\x88\xC1\x89\xC1\x8A\xC1\x8B\xC1\x8C\xC1\x8D\xC1" - b"\x8E\xC1\x8F\xC1\x90\xC1\x91\xC1\x92\xC1\x93\xC1\x94\xC1\x95\xC1" - b"\x96\xC1\x97\xC1\x98\xC1\x99\xC1\x9A\xC1\x9B\xC1\x9C\xC1\x9D\xC1" - b"\x9E\xC1\x9F\xC1\xA0\xC1\xA1\xC1\xA2\xC1\xA3\xC1\xA4\xC1\xA5\xC1" - b"\xA6\xC1\xA7\xC1\xA8\xC1\xA9\xC1\xAA\xC1\xAB\xC1\xAC\xC1\xAD\xC1" - b"\xAE\xC1\xAF\xC1\xB0\xC1\xB1\xC1\xB2\xC1\xB3\xC1\xB4\xC1\xB5\xC1" - b"\xB6\xC1\xB7\xC1\xB8\xC1\xB9\xC1\xBA\xC1\xBB\xC1\xBC\xC1\xBD\xC1" - b"\xBE\xC1\xBF\xC1\xC0\xC1\xC1\xC1\xC2\xC1\xC3\xC1\xC4\xC1\xC5\xC1" - b"\xC6\xC1\xC7\xC1\xC8\xC1\xC9\xC1\xCA\xC1\xCB\xC1\xCC\xC1\xCD\xC1" - b"\xCE\xC1\xCF\xC1\xD0\xC1\xD1\xC1\xD2\xC1\xD3\xC1\xD4\xC1\xD5\xC1" - b"\xD6\xC1\xD7\xC1\xD8\xC1\xD9\xC1\xDA\xC1\xDB\xC1\xDC\xC1\xDD\xC1" - b"\xDE\xC1\xDF\xC1\xE0\xC1\xE1\xC1\xE2\xC1\xE3\xC1\xE4\xC1\xE5\xC1" - b"\xE6\xC1\xE7\xC1\xE8\xC1\xE9\xC1\xEA\xC1\xEB\xC1\xEC\xC1\xED\xC1" - b"\xEE\xC1\xEF\xC1\xF0\xC1\xF1\xC1\xF2\xC1\xF3\xC1\xF4\xC1\xF5\xC1" - b"\xF6\xC1\xF7\xC1\xF8\xC1\xF9\xC1\xFA\xC1\xFB\xC1\xFC\xC1\xFD\xC1" - b"\xFE\xC1\xFF\xC2\x00\x01\x03" + b"\xdf\x71\x00\x71\x01\x71\x02\x71\x03\x71\x04\x71\x05\x71\x06\x71" + b"\x07\x71\x08\x71\x09\x71\x0a\x71\x0b\x71\x0c\x71\x0d\x71\x0e\x71" + b"\x0f\x71\x10\x71\x11\x71\x12\x71\x13\x71\x14\x71\x15\x71\x16\x71" + b"\x17\x71\x18\x71\x19\x71\x1a\x71\x1b\x71\x1c\x71\x1d\x71\x1e\x71" + b"\x1f\x71\x20\x71\x21\x71\x22\x71\x23\x71\x24\x71\x25\x71\x26\x71" + b"\x27\x71\x28\x71\x29\x71\x2a\x71\x2b\x71\x2c\x71\x2d\x71\x2e\x71" + b"\x2f\x71\x30\x71\x31\x71\x32\x71\x33\x71\x34\x71\x35\x71\x36\x71" + b"\x37\x71\x38\x71\x39\x71\x3a\x71\x3b\x71\x3c\x71\x3d\x71\x3e\x71" + b"\x3f\x71\x40\x71\x41\x71\x42\x71\x43\x71\x44\x71\x45\x71\x46\x71" + b"\x47\x71\x48\x71\x49\x71\x4a\x71\x4b\x71\x4c\x71\x4d\x71\x4e\x71" + b"\x4f\x71\x50\x71\x51\x71\x52\x71\x53\x71\x54\x71\x55\x71\x56\x71" + b"\x57\x71\x58\x71\x59\x71\x5a\x71\x5b\x71\x5c\x71\x5d\x71\x5e\x71" + b"\x5f\x71\x60\x71\x61\x71\x62\x71\x63\x71\x64\x71\x65\x71\x66\x71" + b"\x67\x71\x68\x71\x69\x71\x6a\x71\x6b\x71\x6c\x71\x6d\x71\x6e\x71" + b"\x6f\x71\x70\x71\x71\x71\x72\x71\x73\x71\x74\x71\x75\x71\x76\x71" + b"\x77\x71\x78\x71\x79\x71\x7a\x71\x7b\x71\x7c\x71\x7d\x71\x7e\x71" + b"\x7f\x72\xc2\x80\x72\xc2\x81\x72\xc2\x82\x72\xc2\x83\x72\xc2\x84" + b"\x72\xc2\x85\x72\xc2\x86\x72\xc2\x87\x72\xc2\x88\x72\xc2\x89\x72" + b"\xc2\x8a\x72\xc2\x8b\x72\xc2\x8c\x72\xc2\x8d\x72\xc2\x8e\x72\xc2" + b"\x8f\x72\xc2\x90\x72\xc2\x91\x72\xc2\x92\x72\xc2\x93\x72\xc2\x94" + b"\x72\xc2\x95\x72\xc2\x96\x72\xc2\x97\x72\xc2\x98\x72\xc2\x99\x72" + b"\xc2\x9a\x72\xc2\x9b\x72\xc2\x9c\x72\xc2\x9d\x72\xc2\x9e\x72\xc2" + b"\x9f\x72\xc2\xa0\x72\xc2\xa1\x72\xc2\xa2\x72\xc2\xa3\x72\xc2\xa4" + b"\x72\xc2\xa5\x72\xc2\xa6\x72\xc2\xa7\x72\xc2\xa8\x72\xc2\xa9\x72" + b"\xc2\xaa\x72\xc2\xab\x72\xc2\xac\x72\xc2\xad\x72\xc2\xae\x72\xc2" + b"\xaf\x72\xc2\xb0\x72\xc2\xb1\x72\xc2\xb2\x72\xc2\xb3\x72\xc2\xb4" + b"\x72\xc2\xb5\x72\xc2\xb6\x72\xc2\xb7\x72\xc2\xb8\x72\xc2\xb9\x72" + b"\xc2\xba\x72\xc2\xbb\x72\xc2\xbc\x72\xc2\xbd\x72\xc2\xbe\x72\xc2" + b"\xbf\x72\xc3\x80\x72\xc3\x81\x72\xc3\x82\x72\xc3\x83\x72\xc3\x84" + b"\x72\xc3\x85\x72\xc3\x86\x72\xc3\x87\x72\xc3\x88\x72\xc3\x89\x72" + b"\xc3\x8a\x72\xc3\x8b\x72\xc3\x8c\x72\xc3\x8d\x72\xc3\x8e\x72\xc3" + b"\x8f\x72\xc3\x90\x72\xc3\x91\x72\xc3\x92\x72\xc3\x93\x72\xc3\x94" + b"\x72\xc3\x95\x72\xc3\x96\x72\xc3\x97\x72\xc3\x98\x72\xc3\x99\x72" + b"\xc3\x9a\x72\xc3\x9b\x72\xc3\x9c\x72\xc3\x9d\x72\xc3\x9e\x72\xc3" + b"\x9f\x72\xc3\xa0\x72\xc3\xa1\x72\xc3\xa2\x72\xc3\xa3\x72\xc3\xa4" + b"\x72\xc3\xa5\x72\xc3\xa6\x72\xc3\xa7\x72\xc3\xa8\x72\xc3\xa9\x72" + b"\xc3\xaa\x72\xc3\xab\x72\xc3\xac\x72\xc3\xad\x72\xc3\xae\x72\xc3" + b"\xaf\x72\xc3\xb0\x72\xc3\xb1\x72\xc3\xb2\x72\xc3\xb3\x72\xc3\xb4" + b"\x72\xc3\xb5\x72\xc3\xb6\x72\xc3\xb7\x72\xc3\xb8\x72\xc3\xb9\x72" + b"\xc3\xba\x72\xc3\xbb\x72\xc3\xbc\x72\xc3\xbd\x72\xc3\xbe\x72\xc3" + b"\xbf\x72\xc4\x80\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab" + b"\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb" + b"\xbc\xbd\xbe\xbf\xc0\xc1\x21\xc1\x22\xc1\x23\xc1\x24\xc1\x25\xc1" + b"\x26\xc1\x27\xc1\x28\xc1\x29\xc1\x2a\xc1\x2b\xc1\x2c\xc1\x2d\xc1" + b"\x2e\xc1\x2f\xc1\x30\xc1\x31\xc1\x32\xc1\x33\xc1\x34\xc1\x35\xc1" + b"\x36\xc1\x37\xc1\x38\xc1\x39\xc1\x3a\xc1\x3b\xc1\x3c\xc1\x3d\xc1" + b"\x3e\xc1\x3f\xc1\x40\xc1\x41\xc1\x42\xc1\x43\xc1\x44\xc1\x45\xc1" + b"\x46\xc1\x47\xc1\x48\xc1\x49\xc1\x4a\xc1\x4b\xc1\x4c\xc1\x4d\xc1" + b"\x4e\xc1\x4f\xc1\x50\xc1\x51\xc1\x52\xc1\x53\xc1\x54\xc1\x55\xc1" + b"\x56\xc1\x57\xc1\x58\xc1\x59\xc1\x5a\xc1\x5b\xc1\x5c\xc1\x5d\xc1" + b"\x5e\xc1\x5f\xc1\x60\xc1\x61\xc1\x62\xc1\x63\xc1\x64\xc1\x65\xc1" + b"\x66\xc1\x67\xc1\x68\xc1\x69\xc1\x6a\xc1\x6b\xc1\x6c\xc1\x6d\xc1" + b"\x6e\xc1\x6f\xc1\x70\xc1\x71\xc1\x72\xc1\x73\xc1\x74\xc1\x75\xc1" + b"\x76\xc1\x77\xc1\x78\xc1\x79\xc1\x7a\xc1\x7b\xc1\x7c\xc1\x7d\xc1" + b"\x7e\xc1\x7f\xc1\x80\xc1\x81\xc1\x82\xc1\x83\xc1\x84\xc1\x85\xc1" + b"\x86\xc1\x87\xc1\x88\xc1\x89\xc1\x8a\xc1\x8b\xc1\x8c\xc1\x8d\xc1" + b"\x8e\xc1\x8f\xc1\x90\xc1\x91\xc1\x92\xc1\x93\xc1\x94\xc1\x95\xc1" + b"\x96\xc1\x97\xc1\x98\xc1\x99\xc1\x9a\xc1\x9b\xc1\x9c\xc1\x9d\xc1" + b"\x9e\xc1\x9f\xc1\xa0\xc1\xa1\xc1\xa2\xc1\xa3\xc1\xa4\xc1\xa5\xc1" + b"\xa6\xc1\xa7\xc1\xa8\xc1\xa9\xc1\xaa\xc1\xab\xc1\xac\xc1\xad\xc1" + b"\xae\xc1\xaf\xc1\xb0\xc1\xb1\xc1\xb2\xc1\xb3\xc1\xb4\xc1\xb5\xc1" + b"\xb6\xc1\xb7\xc1\xb8\xc1\xb9\xc1\xba\xc1\xbb\xc1\xbc\xc1\xbd\xc1" + b"\xbe\xc1\xbf\xc1\xc0\xc1\xc1\xc1\xc2\xc1\xc3\xc1\xc4\xc1\xc5\xc1" + b"\xc6\xc1\xc7\xc1\xc8\xc1\xc9\xc1\xca\xc1\xcb\xc1\xcc\xc1\xcd\xc1" + b"\xce\xc1\xcf\xc1\xd0\xc1\xd1\xc1\xd2\xc1\xd3\xc1\xd4\xc1\xd5\xc1" + b"\xd6\xc1\xd7\xc1\xd8\xc1\xd9\xc1\xda\xc1\xdb\xc1\xdc\xc1\xdd\xc1" + b"\xde\xc1\xdf\xc1\xe0\xc1\xe1\xc1\xe2\xc1\xe3\xc1\xe4\xc1\xe5\xc1" + b"\xe6\xc1\xe7\xc1\xe8\xc1\xe9\xc1\xea\xc1\xeb\xc1\xec\xc1\xed\xc1" + b"\xee\xc1\xef\xc1\xf0\xc1\xf1\xc1\xf2\xc1\xf3\xc1\xf4\xc1\xf5\xc1" + b"\xf6\xc1\xf7\xc1\xf8\xc1\xf9\xc1\xfa\xc1\xfb\xc1\xfc\xc1\xfd\xc1" + b"\xfe\xc1\xff\xc2\x00\x01\x03" ) == (data + data, b"") def test_unpack_uid(): - assert unpack(b"\xDF\x30\x01\x30\x02\xC1\x01\x03") == ([1, 2, 2], b"") - assert unpack(b"\xDF\x30\x01\x30\x02\xC2\x01\x00\x03") == ([1, 2, 2], b"") - assert unpack(b"\xDF\x30\x01\x30\x02\xC3\x01\x00\x00\x03") == ([1, 2, 2], b"") - assert unpack(b"\xDF\x30\x01\x30\x02\xC4\x01\x00\x00\x00\x03") == ([1, 2, 2], b"") + assert unpack(b"\xdf\x30\x01\x30\x02\xc1\x01\x03") == ([1, 2, 2], b"") + assert unpack(b"\xdf\x30\x01\x30\x02\xc2\x01\x00\x03") == ([1, 2, 2], b"") + assert unpack(b"\xdf\x30\x01\x30\x02\xc3\x01\x00\x00\x03") == ([1, 2, 2], b"") + assert unpack(b"\xdf\x30\x01\x30\x02\xc4\x01\x00\x00\x00\x03") == ([1, 2, 2], b"") def test_golden(): diff --git a/tests/support/test_packet.py b/tests/support/test_packet.py index afa6f8d15..73857e058 100644 --- a/tests/support/test_packet.py +++ b/tests/support/test_packet.py @@ -25,11 +25,11 @@ def test_decode_with_excessive_data(): def test_extend_encode(): - assert Bar.encode(b"\x77", 0x67, 0xAABBCCDD) == b"\x77\x00\x67\xAA\xBB\xCC\xDD" + assert Bar.encode(b"\x77", 0x67, 0xAABBCCDD) == b"\x77\x00\x67\xaa\xbb\xcc\xdd" def test_extend_decode(): - decoded = Bar.decode(b"\x77\x00\x67\xAA\xBB\xCC\xDD") + decoded = Bar.decode(b"\x77\x00\x67\xaa\xbb\xcc\xdd") assert decoded.a == b"\x77" assert decoded.b == 0x0067 assert decoded.c == 0xAABBCCDD