コード例 #1
0
    def test_metaquantity_compatible_units_change(self):
        mq = MetaQuantity(name='vp', units='km/s', family_name='pvelocity')

        mq.units = 'ft/s'
        self.failUnlessEqual(mq.name, 'vp')
        self.failUnlessEqual(mq.units.label, 'ft/s')
        self.failUnlessEqual(mq.family_name, 'pvelocity')
        return
コード例 #2
0
    def test_metaquantity_compatible_units_change(self):
        mq = MetaQuantity( name='vp', units='km/s', family_name='pvelocity')

        mq.units = 'ft/s'
        self.failUnlessEqual( mq.name, 'vp' )
        self.failUnlessEqual( mq.units.label, 'ft/s' )
        self.failUnlessEqual( mq.family_name, 'pvelocity' )
        return
コード例 #3
0
    def test_metaquantity_incompatible_family_change(self):
        mq = MetaQuantity(name='vp', units='km/s', family_name='pvelocity')

        mq.family_name = 'time'

        self.assertEqual(mq.name, 'vp')
        self.assertEqual(mq.units.label, 'msec')
        self.assertEqual(mq.family_name, 'time')
        return
コード例 #4
0
    def test_metaquantity(self):
        mq = MetaQuantity(name='vp', units='km/s', family_name='pvelocity')

        self.failUnlessEqual(mq.name, 'vp')
        self.failUnlessEqual(mq.units.label, 'km/s')
        self.failUnlessEqual(mq.family_name, 'pvelocity')
        return
コード例 #5
0
    def test_metaquantity_incompatible_units_change(self):
        mq = MetaQuantity(name='vp', units='km/s', family_name='pvelocity')

        self.failUnlessRaises(TraitError, setattr, mq, 'units', 'hours')

        self.failUnlessEqual(mq.name, 'vp')
        self.failUnlessEqual(mq.units.label, 'km/s')
        self.failUnlessEqual(mq.family_name, 'pvelocity')
        return
コード例 #6
0
 def ui_simple(self):
     mq = MetaQuantity()
     mq.configure_traits(kind='modal')
     print '\n'
     mq.print_traits()
     return
コード例 #7
0
 def ui_simple(self):
     mq = MetaQuantity()
     mq.configure_traits(kind='modal')
     print '\n'
     mq.print_traits()
     return