def test_slider_edgesounds(self): expected = [ osufile.Slider(x=343, y=300, time=12570, type=2, sound=0, curvetype='P', curvepoints=[(308, 266), (266, 254)], slides=1, length=83.9999974365235, edgesounds=[2, 0], edgesets=[(2, 2), (0, 0)], sample=osufile.HitSample(normal_set=0, addition_set=0, index=0, volume=0, filename='')) ] check = lambda x: self._test_section(x, expected) # extra pipes (ignored) check( '343,300,12570,2,0,P|308:266|266:254,1,83.9999974365235,2|0|5,2:2|0:0,0:0:0:0:' ) # missing pipes (should be filled with 0) check( '343,300,12570,2,0,P|308:266|266:254,1,83.9999974365235,2,2:2|0:0,0:0:0:0:' ) # invalid pipes (should be filled with 0) check( '343,300,12570,2,0,P|308:266|266:254,1,83.9999974365235,2|asdf,2:2|0:0,0:0:0:0:' )
def test_slider_optional_arguments(self): sliders = [ '56,7,11670,2,0,L|152:-2,1,83.9999974365235,0,0:0,0:0:0:0:', '56,7,11670,2,0,L|152:-2,1,83.9999974365235,0,0:0', '56,7,11670,2,0,L|152:-2,1,83.9999974365235,0', '56,7,11670,2,0,L|152:-2,1,83.9999974365235', '56,7,11670,2,0,L|152:-2,1' ] EXPECTED = [ osufile.Slider(x=56, y=7, time=11670, type=2, sound=0, curvetype='L', curvepoints=[(152, -2)], slides=1, length=83.9999974365235, edgesounds=[0], edgesets=[(0, 0)], sample=osufile.HitSample(normal_set=0, addition_set=0, index=0, volume=0, filename='')) for i in range(len(sliders)) ] # the parser doesn't recalculate omitted lengths, it sets the lengths to 0, # so for all sliders with omitted lengths we'll set the expected data to 0 for i in range(4, len(EXPECTED)): EXPECTED[i].length = 0 for s, e in zip(sliders, EXPECTED): self._test_section(s, [e])
def test_slider(self): self._test_section( '442,316,10170,2,0,P|459:276|452:220,1,83.9999974365235,2|0,0:0|0:0,0:0:0:0:', [ osufile.Slider(x=442, y=316, time=10170, type=2, sound=0, curvetype='P', curvepoints=[(459, 276), (452, 220)], slides=1, length=83.9999974365235, edgesounds=[2, 0], edgesets=[(0, 0), (0, 0)], sample=osufile.HitSample(normal_set=0, addition_set=0, index=0, volume=0, filename='')) ]) self._test_section( '56,7,11670,2,0,L|152:-2,1,83.9999974365235,0,0:0,0:0:0:0:', [ osufile.Slider(x=56, y=7, time=11670, type=2, sound=0, curvetype='L', curvepoints=[(152, -2)], slides=1, length=83.9999974365235, edgesounds=[0], edgesets=[(0, 0)], sample=osufile.HitSample(normal_set=0, addition_set=0, index=0, volume=0, filename='')) ])
def test_slider_too_many_arguments(self): self._test_section( '56,7,11670,2,0,L|152:-2,1,83.9999974365235,0,0:0,0:0:0:0:,hi', [ osufile.Slider(x=56, y=7, time=11670, type=2, sound=0, curvetype='L', curvepoints=[(152, -2)], slides=1, length=83.9999974365235, edgesounds=[0], edgesets=[(0, 0)], sample=osufile.HitSample(normal_set=0, addition_set=0, index=0, volume=0, filename='')) ])