fairseq/models/huggingface/__init__.py

Killed 7 out of 15 mutants

Survived

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

Mutant 2833

--- 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 2834

--- 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 2835

--- 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 2836

--- 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 2837

--- 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 2838

--- 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 2839

--- 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 2845

--- 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