# Path: hamster_gtk/preferences/widgets/hamster_spin_button.py
# class HamsterSpinButton(Gtk.SpinButton, ConfigWidget):
#     def __init__(self, adjustment=None, climb_rate=0, digits=0):
#     def _validate_simple_adjustment(self, adjustment):
#     def get_config_value(self):
#     def set_config_value(self, value):


import pytest
from gi.repository import Gtk
from hamster_gtk.preferences.widgets import HamsterSpinButton, SimpleAdjustment

    def test_instance(self):
        """Make sure the widget is still a SpinButton."""
        spin = HamsterSpinButton()
        assert isinstance(spin, Gtk.SpinButton)

    def test_params_constructor(self, simple_adjustment):
        """Make sure the widget can be set up via constructor."""
        spin = HamsterSpinButton(simple_adjustment)
        adjustment = spin.get_adjustment()
        assert adjustment.get_lower() == simple_adjustment.min
        assert adjustment.get_upper() == simple_adjustment.max
        assert adjustment.get_step_increment() == simple_adjustment.step

    def test_params_constructor_adjustment(self, adjustment):
        """Make sure the widget can be set up by passing :class:`Gtk.Adjustment` to constructor."""
        spin = HamsterSpinButton(adjustment)
        assert spin.get_adjustment() == adjustment

    def test_params_constructor_overlapping_bounds(self, simple_adjustment):
        """Passing lower bound greater than upper bound to the constructor should fail."""
        new_adj = SimpleAdjustment(min=simple_adjustment.max, max=simple_adjustment.min,
            step=simple_adjustment.step)
        with pytest.raises(ValueError):
            HamsterSpinButton(new_adj)

    def test_params_constructor_zero_step(self, simple_adjustment):
        """Passing zero as a step to the constructor should fail."""
        new_adj = SimpleAdjustment(min=simple_adjustment.min, max=simple_adjustment.max, step=0)
        with pytest.raises(ValueError):

# Path: hamster_gtk/preferences/widgets/hamster_spin_button.py
# class HamsterSpinButton(Gtk.SpinButton, ConfigWidget):
#     def __init__(self, adjustment=None, climb_rate=0, digits=0):
#     def _validate_simple_adjustment(self, adjustment):
#     def get_config_value(self):
#     def set_config_value(self, value):


# Path: tests/preferences/widgets/test_hamster_spin_button.py
import pytest
from gi.repository import Gtk
from hamster_gtk.preferences.widgets import HamsterSpinButton, SimpleAdjustment


    def test_instance(self):
        """Make sure the widget is still a SpinButton."""
        spin = HamsterSpinButton()
        assert isinstance(spin, Gtk.SpinButton)

    def test_params_constructor(self, simple_adjustment):
        """Make sure the widget can be set up via constructor."""
        spin = HamsterSpinButton(simple_adjustment)
        adjustment = spin.get_adjustment()
        assert adjustment.get_lower() == simple_adjustment.min
        assert adjustment.get_upper() == simple_adjustment.max
        assert adjustment.get_step_increment() == simple_adjustment.step

    def test_params_constructor_adjustment(self, adjustment):
        """Make sure the widget can be set up by passing :class:`Gtk.Adjustment` to constructor."""
        spin = HamsterSpinButton(adjustment)
        assert spin.get_adjustment() == adjustment

    def test_params_constructor_overlapping_bounds(self, simple_adjustment):
        """Passing lower bound greater than upper bound to the constructor should fail."""
        new_adj = SimpleAdjustment(min=simple_adjustment.max, max=simple_adjustment.min,
            step=simple_adjustment.step)
        with pytest.raises(ValueError):
            HamsterSpinButton(new_adj)

    def test_params_constructor_zero_step(self, simple_adjustment):
        """Passing zero as a step to the constructor should fail."""
        new_adj = SimpleAdjustment(min=simple_adjustment.min, max=simple_adjustment.max, step=0)
        with pytest.raises(ValueError):

            HamsterSpinButton(new_adj)