Пример #1
0
    def test_key_exists(self):
        unit_system = random.randint(1, 10)
        SUT = RecordCache()
        key = random_string()
        value = round(random.uniform(1, 100), 2)
        SUT.update_value(key, value, unit_system, time.time())

        SUT.remove_value(key)
        self.assertNotIn(key, SUT.cached_values)
    def test_key_exists(self):
        unit_system = random.randint(1, 10)
        SUT = RecordCache(unit_system)
        key = ''.join([random.choice(string.ascii_letters + string.digits) for n in range(32)])
        value = round(random.uniform(1, 100), 2)
        SUT.update_value(key, value, unit_system, time.time())

        SUT.remove_value(key)
        self.assertNotIn(key, SUT.cached_values)
Пример #3
0
    def test_key_does_not_exist(self):
        # somewhat silly test
        unit_system = random.randint(1, 10)
        SUT = RecordCache()
        key = random_string()
        value = round(random.uniform(1, 100), 2)
        SUT.update_value(key, value, unit_system, time.time())

        nonexisting_key = random_string()
        SUT.remove_value(nonexisting_key)
        self.assertNotIn(nonexisting_key, SUT.cached_values)
Пример #4
0
    def test_key_does_not_exist(self):
        # somewhat silly test
        unit_system = random.randint(1, 10)
        SUT = RecordCache()
        key = ''.join([
            random.choice(string.ascii_letters + string.digits)
            for n in range(32)
        ])
        value = round(random.uniform(1, 100), 2)
        SUT.update_value(key, value, unit_system, time.time())

        nonexisting_key = ''.join([
            random.choice(string.ascii_letters + string.digits)
            for n in range(32)
        ])
        SUT.remove_value(nonexisting_key)
        self.assertNotIn(nonexisting_key, SUT.cached_values)