import pytest

from olympia.core.tests.db_tests_testapp.models import TestRegularCharField


@pytest.mark.django_db
@pytest.mark.parametrize('value', [
    u'a',
    u'🔍',  # Magnifying Glass Tilted Left (U+1F50D)
    u'❤',  # Heavy Black Heart (U+2764, U+FE0F)
])
def test_max_length_utf8mb4(value):
    TestRegularCharField.objects.create(name=value * 255)

    assert TestRegularCharField.objects.get().name == value * 255

import os
import pytest

from olympia.core.tests.db_tests_testapp.models import TestRegularCharField


@pytest.mark.django_db
@pytest.mark.parametrize('value', [
    u'a',
    u'🔍',  # Magnifying Glass Tilted Left (U+1F50D)
    u'❤',  # Heavy Black Heart (U+2764, U+FE0F)
])
def test_max_length_utf8mb4(value):
    TestRegularCharField.objects.create(name=value * 255)

    assert TestRegularCharField.objects.get().name == value * 255


def test_no_duplicate_migration_ids():
    seen = set()

    migration_ids = [
        fname.split('-')[0] for fname in os.listdir('src/olympia/migrations/')
        if fname.endswith('.sql')]

    duplicates = {x for x in migration_ids if x in seen or seen.add(x)}

    assert not duplicates

Add simple test to fail in case of duplicate migration ids.
Add simple test to fail in case of duplicate migration ids.

The test fails by showing which migrations are duplicated.

```python
src/olympia/core/tests/test_db.py:29: in test_no_duplicate_migration_ids
    assert not duplicates
E   AssertionError: assert not {'99'}
```

Fixes #11852

+ import os
  import pytest
  
  from olympia.core.tests.db_tests_testapp.models import TestRegularCharField
  
  
  @pytest.mark.django_db
  @pytest.mark.parametrize('value', [
      u'a',
      u'🔍',  # Magnifying Glass Tilted Left (U+1F50D)
      u'❤',  # Heavy Black Heart (U+2764, U+FE0F)
  ])
  def test_max_length_utf8mb4(value):
      TestRegularCharField.objects.create(name=value * 255)
  
      assert TestRegularCharField.objects.get().name == value * 255
  
+ 
+ def test_no_duplicate_migration_ids():
+     seen = set()
+ 
+     migration_ids = [
+         fname.split('-')[0] for fname in os.listdir('src/olympia/migrations/')
+         if fname.endswith('.sql')]
+ 
+     duplicates = {x for x in migration_ids if x in seen or seen.add(x)}
+ 
+     assert not duplicates
+ 
Add simple test to fail in case of duplicate migration ids.
## Code Before:
import pytest

from olympia.core.tests.db_tests_testapp.models import TestRegularCharField


@pytest.mark.django_db
@pytest.mark.parametrize('value', [
    u'a',
    u'🔍',  # Magnifying Glass Tilted Left (U+1F50D)
    u'❤',  # Heavy Black Heart (U+2764, U+FE0F)
])
def test_max_length_utf8mb4(value):
    TestRegularCharField.objects.create(name=value * 255)

    assert TestRegularCharField.objects.get().name == value * 255

## Instruction:
Add simple test to fail in case of duplicate migration ids.
## Code After:
import os
import pytest

from olympia.core.tests.db_tests_testapp.models import TestRegularCharField


@pytest.mark.django_db
@pytest.mark.parametrize('value', [
    u'a',
    u'🔍',  # Magnifying Glass Tilted Left (U+1F50D)
    u'❤',  # Heavy Black Heart (U+2764, U+FE0F)
])
def test_max_length_utf8mb4(value):
    TestRegularCharField.objects.create(name=value * 255)

    assert TestRegularCharField.objects.get().name == value * 255


def test_no_duplicate_migration_ids():
    seen = set()

    migration_ids = [
        fname.split('-')[0] for fname in os.listdir('src/olympia/migrations/')
        if fname.endswith('.sql')]

    duplicates = {x for x in migration_ids if x in seen or seen.add(x)}

    assert not duplicates
