def setUp(self): random.seed(42) self.chain = Chain(memory=2) for seq in self.seqs: self.chain.train(seq)
def test_dict(self): chain = Chain(self.seq) self.assertEqual(chain, {1: [1, 2], 2: [1]})
def test_walk_start_2(self): chain = Chain(self.seq) self.assertEqual(list(islice(chain.walk(start=2), 10)), [1, 1, 2, 1, 1, 1, 1, 1, 2, 1])
def test_walk_no_start(self): chain = Chain(self.seq) self.assertEqual(list(islice(chain.walk(), 10)), [1, 1, 2])