Beispiel #1
0
def __create_update_price_modifiers(key, value, modifier_map):
    """ Handles creation and updating of price modifier map """
    (_, identifier, field_name) = validate.regex_match_modifiers(key)

    modifier = modifier_map.get(identifier, dict())

    if value is not None and not value.isalpha():
        value = value.replace('$', '')
        value = validate.is_valid_float(value)

    if value is not None:
        modifier[field_name] = value
        modifier_map[identifier] = modifier

    return modifier_map
Beispiel #2
0
 def test_should_fail_if_string_is_not_none(self):
     value = validate.is_valid_float("six")
     self.assertIsNone(value)
Beispiel #3
0
 def test_should_fail_if_float_is_not_valid_float(self):
     expected_value = 6.0
     value = validate.is_valid_float(6.0)
     self.assertEqual(expected_value, value)