"""Tests for creating a simple tight-binding model."""

import pytest

from parameters import T_VALUES, KPT


@pytest.mark.parametrize('t1', T_VALUES)
@pytest.mark.parametrize('k', KPT)
def test_simple(t1, get_model, k, compare_data, models_equal, compare_isclose):
    """Regression test for a simple manually created tight-binding model."""
    model = get_model(*t1)

    compare_isclose(model.hamilton(k), tag='hamilton')
    compare_isclose(model.eigenval(k), tag='eigenval')
    compare_data(models_equal, model)


@pytest.mark.parametrize('t1', T_VALUES)
def test_invalid_dim(t1, get_model):
    """
    Check that an error is raised when the dimension does not match
    the hopping matrix keys.
    """
    with pytest.raises(ValueError):
        get_model(*t1, dim=2)

"""Tests for creating a simple tight-binding model."""

import pytest

from parameters import T_VALUES, KPT


@pytest.mark.parametrize('t1', T_VALUES)
@pytest.mark.parametrize('k', KPT)
def test_simple(t1, get_model, k, compare_data, models_equal, compare_isclose):
    """Regression test for a simple manually created tight-binding model."""
    model = get_model(*t1)

    compare_isclose(model.hamilton(k), tag='hamilton')
    compare_isclose(model.eigenval(k), tag='eigenval')
    compare_data(models_equal, model)


def test_invalid_dim(get_model):
    """
    Check that an error is raised when the reciprocal lattice vector
    does not match the dimension.
    """
    model = get_model(0.1, 0.2)
    model.add_hop(1j, 0, 1, (0, 1, 2))
    with pytest.raises(ValueError):
        model.add_hop(1j, 0, 1, (0, 1))

Fix test broken by previous commit.
Fix test broken by previous commit.

  """Tests for creating a simple tight-binding model."""
  
  import pytest
  
  from parameters import T_VALUES, KPT
  
  
  @pytest.mark.parametrize('t1', T_VALUES)
  @pytest.mark.parametrize('k', KPT)
  def test_simple(t1, get_model, k, compare_data, models_equal, compare_isclose):
      """Regression test for a simple manually created tight-binding model."""
      model = get_model(*t1)
  
      compare_isclose(model.hamilton(k), tag='hamilton')
      compare_isclose(model.eigenval(k), tag='eigenval')
      compare_data(models_equal, model)
  
  
- @pytest.mark.parametrize('t1', T_VALUES)
- def test_invalid_dim(t1, get_model):
+ def test_invalid_dim(get_model):
      """
-     Check that an error is raised when the dimension does not match
-     the hopping matrix keys.
+     Check that an error is raised when the reciprocal lattice vector
+     does not match the dimension.
      """
+     model = get_model(0.1, 0.2)
+     model.add_hop(1j, 0, 1, (0, 1, 2))
      with pytest.raises(ValueError):
-         get_model(*t1, dim=2)
+         model.add_hop(1j, 0, 1, (0, 1))
  
Fix test broken by previous commit.
## Code Before:
"""Tests for creating a simple tight-binding model."""

import pytest

from parameters import T_VALUES, KPT


@pytest.mark.parametrize('t1', T_VALUES)
@pytest.mark.parametrize('k', KPT)
def test_simple(t1, get_model, k, compare_data, models_equal, compare_isclose):
    """Regression test for a simple manually created tight-binding model."""
    model = get_model(*t1)

    compare_isclose(model.hamilton(k), tag='hamilton')
    compare_isclose(model.eigenval(k), tag='eigenval')
    compare_data(models_equal, model)


@pytest.mark.parametrize('t1', T_VALUES)
def test_invalid_dim(t1, get_model):
    """
    Check that an error is raised when the dimension does not match
    the hopping matrix keys.
    """
    with pytest.raises(ValueError):
        get_model(*t1, dim=2)

## Instruction:
Fix test broken by previous commit.
## Code After:
"""Tests for creating a simple tight-binding model."""

import pytest

from parameters import T_VALUES, KPT


@pytest.mark.parametrize('t1', T_VALUES)
@pytest.mark.parametrize('k', KPT)
def test_simple(t1, get_model, k, compare_data, models_equal, compare_isclose):
    """Regression test for a simple manually created tight-binding model."""
    model = get_model(*t1)

    compare_isclose(model.hamilton(k), tag='hamilton')
    compare_isclose(model.eigenval(k), tag='eigenval')
    compare_data(models_equal, model)


def test_invalid_dim(get_model):
    """
    Check that an error is raised when the reciprocal lattice vector
    does not match the dimension.
    """
    model = get_model(0.1, 0.2)
    model.add_hop(1j, 0, 1, (0, 1, 2))
    with pytest.raises(ValueError):
        model.add_hop(1j, 0, 1, (0, 1))
