def test_calculation_width_2_depth_100_error(self): # Depth out of bounds for width 2 width = 2 depth = 100 pattern = "Legitimate depth of 2<->\\d+ for records with width 2 exceeds limit" with self.assertRaisesRegex(RuntimeError, pattern): log_sig = esig.stream2logsig(STREAM, depth)
def test_calculation_width_2_depth_2(self): # tosig implementation width = 2 depth = 2 log_sig = esig.stream2logsig(STREAM, depth) self.assert_allclose(log_sig, LOG_SIGNATURE)
def test_calculation_width_2_depth_1(self): # Pure Python implementation width = 2 depth = 1 log_sig = esig.stream2logsig(STREAM, depth) self.assert_allclose(log_sig, LOG_SIGNATURE[:2])
def test_computed_size_vs_size(self): width = 2 for depth in range(2, 6): with self.subTest(depth=depth): log_sig = esig.stream2logsig(STREAM, depth) size = esig.logsigdim(width, depth) self.assertEqual(size, log_sig.size)
def test_dtype_validation_int64_fails(self): width = 2 depth = 2 stream = np.array([[1, 2], [3, 4], [5, 6]], dtype=np.int64) with self.assertRaises(TypeError): log_sig = esig.stream2logsig(stream, depth)
def test_dtype_validation_float32_passes(self): width = 2 depth = 2 stream = np.array([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]], dtype=np.float32) log_sig = esig.stream2logsig(stream, depth) self.assertGreater(log_sig.size, 0)
def transform(x): return esig.stream2logsig(x, self.depth).reshape(1, -1)
def test_calculation_width_2_depth_0_error(self): width = 2 depth = 0 with self.assertRaises(ValueError): log_sig = esig.stream2logsig(STREAM, depth)