コード例 #1
0
ファイル: test_datatype.py プロジェクト: jdum/odfdo
 def test_encode(self):
     value = "1.847mm"
     unit = Unit(value)
     self.assertEqual(str(unit), value)
コード例 #2
0
ファイル: test_datatype.py プロジェクト: jdum/odfdo
 def test_eq(self):
     unit1 = Unit("2.54cm")
     unit2 = Unit("2.54cm")
     self.assertTrue(unit1 == unit2)
コード例 #3
0
ファイル: test_datatype.py プロジェクト: jdum/odfdo
 def test_int(self):
     unit = Unit(1)
     self.assertEqual(unit.value, Decimal("1"))
     self.assertEqual(unit.unit, "cm")
コード例 #4
0
ファイル: test_datatype.py プロジェクト: jdum/odfdo
 def test_float(self):
     unit = Unit(3.14)
     self.assertEqual(unit.value, Decimal("3.14"))
     self.assertEqual(unit.unit, "cm")
コード例 #5
0
ファイル: test_datatype.py プロジェクト: jdum/odfdo
 def test_convert(self):
     unit = Unit("10cm")
     self.assertEqual(unit.convert("px"), Unit("283px"))
コード例 #6
0
ファイル: test_datatype.py プロジェクト: jdum/odfdo
 def test_str(self):
     unit = Unit("1.847mm")
     self.assertEqual(unit.value, Decimal("1.847"))
     self.assertEqual(unit.unit, "mm")
コード例 #7
0
ファイル: test_datatype.py プロジェクト: jdum/odfdo
 def test_gt(self):
     unit1 = Unit("2.54cm")
     unit2 = Unit("2.53cm")
     self.assertTrue(unit1 > unit2)
コード例 #8
0
ファイル: test_datatype.py プロジェクト: jdum/odfdo
 def test_ngt(self):
     unit1 = Unit("2.54cm")
     unit2 = Unit("2.53cm")
     self.assertFalse(unit1 < unit2)
コード例 #9
0
ファイル: test_datatype.py プロジェクト: thorstenb/odfdo
 def test_float(self):
     unit = Unit(3.14)
     self.assertEqual(unit.value, Decimal('3.14'))
     self.assertEqual(unit.unit, 'cm')
コード例 #10
0
ファイル: test_datatype.py プロジェクト: thorstenb/odfdo
 def test_eq(self):
     unit1 = Unit('2.54cm')
     unit2 = Unit('2.54cm')
     self.assertTrue(unit1 == unit2)
コード例 #11
0
ファイル: test_datatype.py プロジェクト: thorstenb/odfdo
 def test_int(self):
     unit = Unit(1)
     self.assertEqual(unit.value, Decimal('1'))
     self.assertEqual(unit.unit, 'cm')
コード例 #12
0
ファイル: test_datatype.py プロジェクト: thorstenb/odfdo
 def test_str(self):
     unit = Unit('1.847mm')
     self.assertEqual(unit.value, Decimal('1.847'))
     self.assertEqual(unit.unit, 'mm')
コード例 #13
0
ファイル: test_datatype.py プロジェクト: thorstenb/odfdo
 def test_convert(self):
     unit = Unit('10cm')
     self.assertEqual(unit.convert('px'), Unit('283px'))
コード例 #14
0
ファイル: test_datatype.py プロジェクト: thorstenb/odfdo
 def test_gt(self):
     unit1 = Unit('2.54cm')
     unit2 = Unit('2.53cm')
     self.assertTrue(unit1 > unit2)
コード例 #15
0
ファイル: test_datatype.py プロジェクト: thorstenb/odfdo
 def test_nlt(self):
     unit1 = Unit('2.53cm')
     unit2 = Unit('2.54cm')
     self.assertFalse(unit1 > unit2)