def simple_execution_test(): algorithms = [ features.ConstantPointCoordinates(), features.ConstantPointCoordinates(strokes=0), features.FirstNPoints(), # features.Bitmap(), features.Ink(), features.AspectRatio(), features.Width(), features.Time(), features.CenterOfMass(), features.StrokeCenter(), features.StrokeCenter(8), features.StrokeIntersections(), features.ReCurvature() ] for algorithm in algorithms: recording = testhelper.get_symbol_as_handwriting(292934) algorithm(recording)
def stroke_intersections_test(): f = features.StrokeIntersections(strokes=4) recording = testhelper.get_symbol_as_handwriting(293035) x = f(recording) nose.tools.assert_equal(x, [0, 1, 0, 0, 0, 0, 0, 0, 0, 0])
def stroke_intersection2_test(): """A 't' has two strokes. They don't intersect themselves, but they intersect once.""" recording = testhelper.get_symbol_as_handwriting(293035) feature = features.StrokeIntersections(2) nose.tools.assert_equal(feature(recording), [0, 1, 0])
def stroke_intersection1_test(): """A '&' has one stroke. This stroke intersects itself once.""" recording = testhelper.get_symbol_as_handwriting(97705) feature = features.StrokeIntersections(1) nose.tools.assert_equal(feature(recording), [2])
def test_stroke_intersections(): f = features.StrokeIntersections(strokes=4) recording = testhelper.get_symbol_as_handwriting(293035) x = f(recording) assert x == [0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
def test_stroke_intersection2(): """A 't' has two strokes. They don't intersect themselves, but they intersect once.""" recording = testhelper.get_symbol_as_handwriting(293035) feature = features.StrokeIntersections(2) assert feature(recording) == [0, 1, 0]
def test_stroke_intersection1(): """A '&' has one stroke. This stroke intersects itself once.""" recording = testhelper.get_symbol_as_handwriting(97705) feature = features.StrokeIntersections(1) assert feature(recording) == [2]