Commit 52f4fa56 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

create fuzzylowertext and refactor

parent 1297a106
import string
from factory import DjangoModelFactory, fuzzy
from faker import Factory
from metagenedb.apps.catalog import models
from .fuzzy_base import FuzzyLowerText
faker = Factory.create()
SELECTED_SOURCE = [i[0] for i in models.Function.SOURCE_CHOICES]
......@@ -15,5 +15,4 @@ class FunctionFactory(DjangoModelFactory):
model = models.Function
source = fuzzy.FuzzyChoice(SELECTED_SOURCE)
function_id = fuzzy.FuzzyText(prefix='function-', length=15,
chars=string.ascii_lowercase + ''.join(map(str, range(1, 10))))
function_id = FuzzyLowerText(prefix='function-', length=15)
import string
from factory import fuzzy
class FuzzyLowerText(fuzzy.FuzzyText):
CHARS = string.ascii_lowercase + ''.join(map(str, range(1, 10)))
def __init__(self, **kwargs):
super(FuzzyLowerText, self).__init__(chars=self.CHARS, **kwargs)
import string
from factory import DjangoModelFactory, fuzzy
from faker import Factory
from metagenedb.apps.catalog import models
from .fuzzy_base import FuzzyLowerText
faker = Factory.create()
SELECTED_SOURCE = [i[0] for i in models.Function.SOURCE_CHOICES]
......@@ -14,6 +14,5 @@ class GeneFactory(DjangoModelFactory):
class Meta:
model = models.Gene
gene_id = fuzzy.FuzzyText(prefix='gene-', length=15,
chars=string.ascii_lowercase + ''.join(map(str, range(1, 10))))
gene_id = FuzzyLowerText(prefix='gene-', length=15)
length = fuzzy.FuzzyInteger(200, 10000)
import string
from factory import DjangoModelFactory, fuzzy
from faker import Factory
from metagenedb.apps.catalog import models
from .fuzzy_base import FuzzyLowerText
faker = Factory.create()
SELECTED_RANK = [i[0] for i in models.Taxonomy.RANK_CHOICES]
......@@ -15,5 +15,4 @@ class TaxonomyFactory(DjangoModelFactory):
model = models.Taxonomy
rank = fuzzy.FuzzyChoice(SELECTED_RANK)
tax_id = fuzzy.FuzzyText(prefix='tax-', length=15,
chars=string.ascii_lowercase + ''.join(map(str, range(1, 10))))
tax_id = FuzzyLowerText(prefix='tax-', length=15)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment