import os
import sys

import pytest
from hypothesis_auto import auto_pytest_magic

from isort import main

auto_pytest_magic(main.sort_imports)


def test_is_python_file():
    assert main.is_python_file("file.py")
    assert main.is_python_file("file.pyi")
    assert main.is_python_file("file.pyx")
    assert not main.is_python_file("file.pyc")
    assert not main.is_python_file("file.txt")
    assert not main.is_python_file("file.pex")


@pytest.mark.skipif(sys.platform == "win32", reason="cannot create fifo file on Windows platform")
def test_is_python_file_fifo(tmpdir):
    fifo_file = os.path.join(tmpdir, "fifo_file")
    os.mkfifo(fifo_file)
    assert not main.is_python_file(fifo_file)


def test_isort_command():
    """Ensure ISortCommand got registered, otherwise setuptools error must have occured"""
    assert main.ISortCommand

import os
import sys

import pytest
from hypothesis_auto import auto_pytest_magic

from isort import main
from isort.settings import DEFAULT_CONFIG

auto_pytest_magic(main.sort_imports)


def test_iter_source_code(tmpdir):
    tmp_file = tmpdir.join("file.py")
    tmp_file.write("import os, sys\n")
    assert tuple(main.iter_source_code((tmp_file,), DEFAULT_CONFIG, [])) == (tmp_file,)


def test_is_python_file():
    assert main.is_python_file("file.py")
    assert main.is_python_file("file.pyi")
    assert main.is_python_file("file.pyx")
    assert not main.is_python_file("file.pyc")
    assert not main.is_python_file("file.txt")
    assert not main.is_python_file("file.pex")


@pytest.mark.skipif(sys.platform == "win32", reason="cannot create fifo file on Windows platform")
def test_is_python_file_fifo(tmpdir):
    fifo_file = os.path.join(tmpdir, "fifo_file")
    os.mkfifo(fifo_file)
    assert not main.is_python_file(fifo_file)


def test_isort_command():
    """Ensure ISortCommand got registered, otherwise setuptools error must have occured"""
    assert main.ISortCommand

Add test case for iter_source_code
Add test case for iter_source_code

  import os
  import sys
  
  import pytest
  from hypothesis_auto import auto_pytest_magic
  
  from isort import main
+ from isort.settings import DEFAULT_CONFIG
  
  auto_pytest_magic(main.sort_imports)
+ 
+ 
+ def test_iter_source_code(tmpdir):
+     tmp_file = tmpdir.join("file.py")
+     tmp_file.write("import os, sys\n")
+     assert tuple(main.iter_source_code((tmp_file,), DEFAULT_CONFIG, [])) == (tmp_file,)
  
  
  def test_is_python_file():
      assert main.is_python_file("file.py")
      assert main.is_python_file("file.pyi")
      assert main.is_python_file("file.pyx")
      assert not main.is_python_file("file.pyc")
      assert not main.is_python_file("file.txt")
      assert not main.is_python_file("file.pex")
  
  
  @pytest.mark.skipif(sys.platform == "win32", reason="cannot create fifo file on Windows platform")
  def test_is_python_file_fifo(tmpdir):
      fifo_file = os.path.join(tmpdir, "fifo_file")
      os.mkfifo(fifo_file)
      assert not main.is_python_file(fifo_file)
  
  
  def test_isort_command():
      """Ensure ISortCommand got registered, otherwise setuptools error must have occured"""
      assert main.ISortCommand
  
Add test case for iter_source_code
## Code Before:
import os
import sys

import pytest
from hypothesis_auto import auto_pytest_magic

from isort import main

auto_pytest_magic(main.sort_imports)


def test_is_python_file():
    assert main.is_python_file("file.py")
    assert main.is_python_file("file.pyi")
    assert main.is_python_file("file.pyx")
    assert not main.is_python_file("file.pyc")
    assert not main.is_python_file("file.txt")
    assert not main.is_python_file("file.pex")


@pytest.mark.skipif(sys.platform == "win32", reason="cannot create fifo file on Windows platform")
def test_is_python_file_fifo(tmpdir):
    fifo_file = os.path.join(tmpdir, "fifo_file")
    os.mkfifo(fifo_file)
    assert not main.is_python_file(fifo_file)


def test_isort_command():
    """Ensure ISortCommand got registered, otherwise setuptools error must have occured"""
    assert main.ISortCommand

## Instruction:
Add test case for iter_source_code
## Code After:
import os
import sys

import pytest
from hypothesis_auto import auto_pytest_magic

from isort import main
from isort.settings import DEFAULT_CONFIG

auto_pytest_magic(main.sort_imports)


def test_iter_source_code(tmpdir):
    tmp_file = tmpdir.join("file.py")
    tmp_file.write("import os, sys\n")
    assert tuple(main.iter_source_code((tmp_file,), DEFAULT_CONFIG, [])) == (tmp_file,)


def test_is_python_file():
    assert main.is_python_file("file.py")
    assert main.is_python_file("file.pyi")
    assert main.is_python_file("file.pyx")
    assert not main.is_python_file("file.pyc")
    assert not main.is_python_file("file.txt")
    assert not main.is_python_file("file.pex")


@pytest.mark.skipif(sys.platform == "win32", reason="cannot create fifo file on Windows platform")
def test_is_python_file_fifo(tmpdir):
    fifo_file = os.path.join(tmpdir, "fifo_file")
    os.mkfifo(fifo_file)
    assert not main.is_python_file(fifo_file)


def test_isort_command():
    """Ensure ISortCommand got registered, otherwise setuptools error must have occured"""
    assert main.ISortCommand
