示例#1
0
 def test_misc(self):
     d1=Duration(4, 0, Rat(1, 1))
     d2=Duration(4, 1, Rat(1, 1))
     self.assertFalse(d1 == d2)
     self.assertEquals(d1.get_rat_value(), Rat(1, 4))
     self.assertEquals(d2.get_rat_value(), Rat(3, 8))
     d3=Duration(4, 2, Rat(2, 3))
     self.assertEquals(d3.get_rat_value(), Rat(7, 24))
示例#2
0
 def test_misc(self):
     d1 = Duration(4, 0, Rat(1, 1))
     d2 = Duration(4, 1, Rat(1, 1))
     self.assertFalse(d1 == d2)
     self.assertEquals(d1.get_rat_value(), Rat(1, 4))
     self.assertEquals(d2.get_rat_value(), Rat(3, 8))
     d3 = Duration(4, 2, Rat(2, 3))
     self.assertEquals(d3.get_rat_value(), Rat(7, 24))
示例#3
0
 def test_constructor(self):
     for a, b, f in ((1, 0, 1.0), (2, 0, 0.5), (2, 1, 0.75)):
         d = Duration(a, b)
         r = d.get_rat_value()
         self.assertEquals(float(r), f)
示例#4
0
 def test_constructor(self):
     for a, b, f in ((1, 0, 1.0), (2, 0, 0.5), (2, 1, 0.75)):
         d = Duration(a, b)
         r = d.get_rat_value()
         self.assertEquals(float(r), f)