# Path: soco/data_structures.py
# class DidlMusicTrack(DidlAudioItem):
# 
#     """Class that represents a music library track."""
# 
#     # the DIDL Lite class for this object.
#     item_class = "object.item.audioItem.musicTrack"
#     # name: (ns, tag)
#     _translation = DidlAudioItem._translation.copy()
#     _translation.update(
#         {
#             "artist": ("upnp", "artist"),
#             "album": ("upnp", "album"),
#             "original_track_number": ("upnp", "originalTrackNumber"),
#             "playlist": ("upnp", "playlist"),
#             "contributor": ("dc", "contributor"),
#             "date": ("dc", "date"),
#         }
#     )
# 
# class DidlPlaylistContainer(DidlContainer):
# 
#     """Class that represents a music library play list."""
# 
#     # (str) The DIDL Lite class for this object
#     item_class = "object.container.playlistContainer"
#     # Yes, really. Sonos uses the item tag, not the container tag. But
#     # sometimes it uses the container tag, eg:
#     # >>> s=soco.SoCo('192.168.1.102')
#     # >>> s.get_playlists()
#     # See https://github.com/SoCo/SoCo/issues/353
#     tag = "item"
#     # name: (ns, tag)
#     _translation = DidlContainer._translation.copy()
#     _translation.update(
#         {
#             "artist": ("upnp", "artist"),
#             "genre": ("upnp", "genre"),
#             "long_description": ("upnp", "longDescription"),
#             "producer": ("dc", "producer"),
#             "contributor": ("dc", "contributor"),
#             "description": ("dc", "description"),
#             "date": ("dc", "date"),
#             "language": ("dc", "language"),
#             "rights": ("dc", "rights"),
#         }
#     )
# 
# class SearchResult(ListOfMusicInfoItems):
# 
#     """Container class that represents a search or browse result.
# 
#     Browse is just a special case of search.
#     """
# 
#     def __init__(self, items, search_type, number_returned, total_matches, update_id):
#         super().__init__(items, number_returned, total_matches, update_id)
#         self._metadata["search_type"] = search_type
# 
#     def __repr__(self):
#         return "{}(items={}, search_type='{}')".format(
#             self.__class__.__name__,
#             super().__repr__(),
#             self.search_type,
#         )
# 
#     @property
#     def search_type(self):
#         """str: the search type."""
#         return self._metadata["search_type"]
# 
# Path: soco/exceptions.py
# class SoCoUPnPException(SoCoException):
# 
#     """A UPnP Fault Code, raised in response to actions sent over the
#     network.
# 
#     """
# 
#     def __init__(self, message, error_code, error_xml, error_description=""):
#         """
#         Args:
#             message (str): The message from the server.
#             error_code (str): The UPnP Error Code as a string.
#             error_xml (str): The xml containing the error, as a utf-8
#                 encoded string.
#             error_description (str): A description of the error. Default is ""
#         """
#         super().__init__()
#         self.message = message
#         self.error_code = error_code
#         self.error_description = error_description
#         self.error_xml = error_xml
# 
#     def __str__(self):
#         return self.message


import time
import pytest
import soco as soco_module
from soco.data_structures import (
    DidlMusicTrack,
    DidlPlaylistContainer,
    SearchResult,
)
from soco.music_library import MusicLibrary
from soco.exceptions import SoCoUPnPException
class TestTreble:
    """Integration tests for the treble property.

    This class implements a full boundary value test.
    """

    valid_values = range(-10, 11)

    @pytest.fixture(autouse=True)
    def restore_treble(self, soco):
        """A fixture which restores treble EQ after each test in the class is
        run."""
        old = soco.treble
        yield
        soco.treble = old
        wait()

    def test_get_and_set(self, soco):
        """Test if the set functionlity works when given valid arguments."""
        assert soco.treble in self.valid_values
        # Values on the boundaries of the valid equivalence partition
        for value in [self.valid_values[0], self.valid_values[-1]]:
            soco.treble = value
            wait()
            assert soco.treble == value

    def test_invalid_arguments(self, soco):
        """Test if the set functionality produces the expected "coerce in
        range" functionality when given a value outside its range."""
        # Values on the boundaries of the two invalid equivalence partitions

# Path: soco/data_structures.py
# class DidlMusicTrack(DidlAudioItem):
# 
#     """Class that represents a music library track."""
# 
#     # the DIDL Lite class for this object.
#     item_class = "object.item.audioItem.musicTrack"
#     # name: (ns, tag)
#     _translation = DidlAudioItem._translation.copy()
#     _translation.update(
#         {
#             "artist": ("upnp", "artist"),
#             "album": ("upnp", "album"),
#             "original_track_number": ("upnp", "originalTrackNumber"),
#             "playlist": ("upnp", "playlist"),
#             "contributor": ("dc", "contributor"),
#             "date": ("dc", "date"),
#         }
#     )
# 
# class DidlPlaylistContainer(DidlContainer):
# 
#     """Class that represents a music library play list."""
# 
#     # (str) The DIDL Lite class for this object
#     item_class = "object.container.playlistContainer"
#     # Yes, really. Sonos uses the item tag, not the container tag. But
#     # sometimes it uses the container tag, eg:
#     # >>> s=soco.SoCo('192.168.1.102')
#     # >>> s.get_playlists()
#     # See https://github.com/SoCo/SoCo/issues/353
#     tag = "item"
#     # name: (ns, tag)
#     _translation = DidlContainer._translation.copy()
#     _translation.update(
#         {
#             "artist": ("upnp", "artist"),
#             "genre": ("upnp", "genre"),
#             "long_description": ("upnp", "longDescription"),
#             "producer": ("dc", "producer"),
#             "contributor": ("dc", "contributor"),
#             "description": ("dc", "description"),
#             "date": ("dc", "date"),
#             "language": ("dc", "language"),
#             "rights": ("dc", "rights"),
#         }
#     )
# 
# class SearchResult(ListOfMusicInfoItems):
# 
#     """Container class that represents a search or browse result.
# 
#     Browse is just a special case of search.
#     """
# 
#     def __init__(self, items, search_type, number_returned, total_matches, update_id):
#         super().__init__(items, number_returned, total_matches, update_id)
#         self._metadata["search_type"] = search_type
# 
#     def __repr__(self):
#         return "{}(items={}, search_type='{}')".format(
#             self.__class__.__name__,
#             super().__repr__(),
#             self.search_type,
#         )
# 
#     @property
#     def search_type(self):
#         """str: the search type."""
#         return self._metadata["search_type"]
# 
# Path: soco/exceptions.py
# class SoCoUPnPException(SoCoException):
# 
#     """A UPnP Fault Code, raised in response to actions sent over the
#     network.
# 
#     """
# 
#     def __init__(self, message, error_code, error_xml, error_description=""):
#         """
#         Args:
#             message (str): The message from the server.
#             error_code (str): The UPnP Error Code as a string.
#             error_xml (str): The xml containing the error, as a utf-8
#                 encoded string.
#             error_description (str): A description of the error. Default is ""
#         """
#         super().__init__()
#         self.message = message
#         self.error_code = error_code
#         self.error_description = error_description
#         self.error_xml = error_xml
# 
#     def __str__(self):
#         return self.message


# Path: tests/test_integration.py
import time
import pytest
import soco as soco_module
from soco.data_structures import (
    DidlMusicTrack,
    DidlPlaylistContainer,
    SearchResult,
)
from soco.music_library import MusicLibrary
from soco.exceptions import SoCoUPnPException

class TestTreble:
    """Integration tests for the treble property.

    This class implements a full boundary value test.
    """

    valid_values = range(-10, 11)

    @pytest.fixture(autouse=True)
    def restore_treble(self, soco):
        """A fixture which restores treble EQ after each test in the class is
        run."""
        old = soco.treble
        yield
        soco.treble = old
        wait()

    def test_get_and_set(self, soco):
        """Test if the set functionlity works when given valid arguments."""
        assert soco.treble in self.valid_values
        # Values on the boundaries of the valid equivalence partition
        for value in [self.valid_values[0], self.valid_values[-1]]:
            soco.treble = value
            wait()
            assert soco.treble == value

    def test_invalid_arguments(self, soco):
        """Test if the set functionality produces the expected "coerce in
        range" functionality when given a value outside its range."""
        # Values on the boundaries of the two invalid equivalence partitions

        soco.treble = self.valid_values[0] - 1