Пример #1
0
    def test_write_stk_targets(self):
        periods = [1, 2]
        times = [[0, 1, 2], [3, 4, 5, 6]]
        values = [[0, 1, 2], [3, 4, 5, 7]]
        self.tff.debug = True
        self.tff.analyze(periods, times, values)

        targets = np.dstack(pytff.stack_targets(times, values))
        for idx, t in enumerate(targets):
            ch = pytff.cache_hash(t)
            self.assertIn(ch, self.tff.targets_cache)
            with open(self.tff.targets_cache[ch]) as fp:
                linenos = len(fp.readlines())
            self.assertTrue(len(times[idx]) == len(values[idx]) == linenos)
Пример #2
0
 def test_cache_hash(self):
     data = [
         six.text_type(random.random()),
         np.random.randn(10), six.b("hhh"), "hhh"]
     for elem in data:
         pytff.cache_hash(elem)