def randomize_value(self) -> None:
     if (config.INSTANCE.constant_seeding
             and StaticConstantSeeding().has_strings
             and randomness.next_float() <= 0.90):
         self._value = StaticConstantSeeding().random_string
     else:
         length = randomness.next_int(0, config.INSTANCE.string_length + 1)
         self._value = randomness.next_string(length)
 def randomize_value(self) -> None:
     if (config.INSTANCE.constant_seeding
             and StaticConstantSeeding().has_ints
             and randomness.next_float() <= 0.90):
         self._value = StaticConstantSeeding().random_int
     else:
         self._value = int(randomness.next_gaussian() *
                           config.INSTANCE.max_int)
 def randomize_value(self) -> None:
     if (config.INSTANCE.constant_seeding
             and StaticConstantSeeding().has_floats
             and randomness.next_float() <= 0.90):
         self._value = StaticConstantSeeding().random_float
     else:
         val = randomness.next_gaussian() * config.INSTANCE.max_int
         precision = randomness.next_int(0, 7)
         self._value = round(val, precision)
Exemple #4
0
 def _setup_constant_seeding_collection(self) -> None:
     """Collect constants from SUT, if enabled."""
     if config.INSTANCE.constant_seeding:
         self._logger.info("Collecting constants from SUT.")
         StaticConstantSeeding().collect_constants(config.INSTANCE.project_path)
def test_singleton():
    seeding_1 = StaticConstantSeeding()
    seeding_2 = StaticConstantSeeding()
    assert seeding_1 is seeding_2
def seeding():
    seeding = StaticConstantSeeding()
    seeding._constants = {"float": set(), "int": set(), "str": set()}
    return seeding