fairseq/models/huggingface/__init__.py

Killed 7 out of 15 mutants

Survived

Survived mutation testing. These mutants show holes in your test suite.

Mutant 1658

--- fairseq/models/huggingface/__init__.py
+++ fairseq/models/huggingface/__init__.py
@@ -12,7 +12,7 @@
 for file in os.listdir(models_dir):
     path = os.path.join(models_dir, file)
     if (
-        not file.startswith('_')
+         file.startswith('_')
         and not file.startswith('.')
         and (file.endswith('.py') or os.path.isdir(path))
     ):

Mutant 1659

--- fairseq/models/huggingface/__init__.py
+++ fairseq/models/huggingface/__init__.py
@@ -12,7 +12,7 @@
 for file in os.listdir(models_dir):
     path = os.path.join(models_dir, file)
     if (
-        not file.startswith('_')
+        not file.startswith('XX_XX')
         and not file.startswith('.')
         and (file.endswith('.py') or os.path.isdir(path))
     ):

Mutant 1660

--- fairseq/models/huggingface/__init__.py
+++ fairseq/models/huggingface/__init__.py
@@ -13,7 +13,7 @@
     path = os.path.join(models_dir, file)
     if (
         not file.startswith('_')
-        and not file.startswith('.')
+        and  file.startswith('.')
         and (file.endswith('.py') or os.path.isdir(path))
     ):
         model_name = file[:file.find('.py')] if file.endswith('.py') else file

Mutant 1661

--- fairseq/models/huggingface/__init__.py
+++ fairseq/models/huggingface/__init__.py
@@ -13,7 +13,7 @@
     path = os.path.join(models_dir, file)
     if (
         not file.startswith('_')
-        and not file.startswith('.')
+        and not file.startswith('XX.XX')
         and (file.endswith('.py') or os.path.isdir(path))
     ):
         model_name = file[:file.find('.py')] if file.endswith('.py') else file

Mutant 1662

--- fairseq/models/huggingface/__init__.py
+++ fairseq/models/huggingface/__init__.py
@@ -14,7 +14,7 @@
     if (
         not file.startswith('_')
         and not file.startswith('.')
-        and (file.endswith('.py') or os.path.isdir(path))
+        and (file.endswith('XX.pyXX') or os.path.isdir(path))
     ):
         model_name = file[:file.find('.py')] if file.endswith('.py') else file
         module = importlib.import_module('fairseq.models.huggingface.' + model_name)

Mutant 1663

--- fairseq/models/huggingface/__init__.py
+++ fairseq/models/huggingface/__init__.py
@@ -14,7 +14,7 @@
     if (
         not file.startswith('_')
         and not file.startswith('.')
-        and (file.endswith('.py') or os.path.isdir(path))
+        and (file.endswith('.py') and os.path.isdir(path))
     ):
         model_name = file[:file.find('.py')] if file.endswith('.py') else file
         module = importlib.import_module('fairseq.models.huggingface.' + model_name)

Mutant 1664

--- fairseq/models/huggingface/__init__.py
+++ fairseq/models/huggingface/__init__.py
@@ -12,8 +12,7 @@
 for file in os.listdir(models_dir):
     path = os.path.join(models_dir, file)
     if (
-        not file.startswith('_')
-        and not file.startswith('.')
+        not file.startswith('_') or not file.startswith('.')
         and (file.endswith('.py') or os.path.isdir(path))
     ):
         model_name = file[:file.find('.py')] if file.endswith('.py') else file

Mutant 1670

--- fairseq/models/huggingface/__init__.py
+++ fairseq/models/huggingface/__init__.py
@@ -17,5 +17,5 @@
         and (file.endswith('.py') or os.path.isdir(path))
     ):
         model_name = file[:file.find('.py')] if file.endswith('.py') else file
-        module = importlib.import_module('fairseq.models.huggingface.' + model_name)
+        module = None