Пример #1
0
 def test_next(self):
     datafile = 'examples/data/colors.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.load(datafile)
     value = r.next()
     assert isinstance(value, str)
Пример #2
0
 def test_next(self):
     datafile = 'examples/data/colors.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.load(datafile)
     value = r.next()
     assert isinstance(value, str)
Пример #3
0
 def test_read_size_option(self):
     datafile = 'examples/data/colors.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.set_read_size(2)
     r.load(datafile)
     r._refresh_all(r._read_size)
     assert len(r.files[datafile].current_lines) == 2
Пример #4
0
 def test_duplicate_file_allowed(self):
     datafile = 'examples/data/colors.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.load(datafile).load(datafile).load(datafile)
     result = r.next()
     result = result.split('_')
     assert len(result) == 3
Пример #5
0
 def test_duplicate_file_allowed(self):
     datafile = 'examples/data/colors.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.load(datafile).load(datafile).load(datafile)
     result = r.next()
     result = result.split('_')
     assert len(result) == 3
Пример #6
0
 def test_read_size_option(self):
     datafile = 'examples/data/colors.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.set_read_size(2)
     r.load(datafile)
     r._refresh_all(r._read_size)
     assert len(r.files[datafile].current_lines) == 2
Пример #7
0
 def test_iterable(self):
     datafile = 'examples/data/colors.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.load(datafile)
     i = []
     for x in r:
         i.append(x)
         break
     assert i != []
Пример #8
0
 def test_iterable(self):
     datafile = 'examples/data/colors.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.load(datafile)
     i = []
     for x in r:
         i.append(x)
         break
     assert i != []
Пример #9
0
 def test_unique_option(self):
     datafile = 'examples/data/colors.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.set_unique(True)
     r.load(datafile)
     i = []
     for x in r:
         i.append(x)
     assert i != []
     assert len(i) == r._total_combinations
Пример #10
0
 def test_unique_option(self):
     datafile = 'examples/data/colors.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.set_unique(True)
     r.load(datafile)
     i = []
     for x in r:
         i.append(x)
     assert i != []
     assert len(i) == r._total_combinations
Пример #11
0
    def test_hard_reset(self):
        datafile = 'examples/data/colors.txt'
        seed_value = 123
        r = RanCat(seed=seed_value, unique=True)
        r.load(datafile).load(datafile)
        i = []
        for x in r:
            i.append(x)
        assert i != []
        assert len(i) == r._total_combinations

        r = r.hard_reset()
        i = []
        for x in r:
            i.append(x)
        assert i == []
        assert len(r.files) == 0
        assert len(i) == r._total_combinations
Пример #12
0
    def test_hard_reset(self):
        datafile = 'examples/data/colors.txt'
        seed_value = 123
        r = RanCat(seed=seed_value, unique=True)
        r.load(datafile).load(datafile)
        i = []
        for x in r:
            i.append(x)
        assert i != []
        assert len(i) == r._total_combinations

        r = r.hard_reset()
        i = []
        for x in r:
            i.append(x)
        assert i == []
        assert len(r.files) == 0
        assert len(i) == r._total_combinations
Пример #13
0
# Example 1 - Generate names from files
from rancat import RanCat

r = RanCat(seed=12335).load('examples/data/jedi.txt')
r.load('examples/data/got.txt')
for i in range(0, 10):
    print(r.next())
Пример #14
0
 def test_load(self):
     datafile = 'examples/data/colors.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.load(datafile)
     assert len(r.files) == 1
Пример #15
0
 def test_load_url(self):
     data_url = 'http://www.sample-videos.com/text/Sample-text-file-10kb.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.load(data_url)
     assert len(r.files) == 1
Пример #16
0
 def test_load(self):
     datafile = 'examples/data/colors.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.load(datafile)
     assert len(r.files) == 1
Пример #17
0
 def test_load_url(self):
     data_url = 'http://www.sample-videos.com/text/Sample-text-file-10kb.txt'
     seed_value = 123
     r = RanCat(seed=seed_value)
     r.load(data_url)
     assert len(r.files) == 1