702 with self.mh() as (cnx, mh): |
702 with self.mh() as (cnx, mh): |
703 self.assertFalse(self.table_sql(mh, 'same_as_relation')) |
703 self.assertFalse(self.table_sql(mh, 'same_as_relation')) |
704 mh.cmd_add_relation_type('same_as') |
704 mh.cmd_add_relation_type('same_as') |
705 self.assertTrue(self.table_sql(mh, 'same_as_relation')) |
705 self.assertTrue(self.table_sql(mh, 'same_as_relation')) |
706 |
706 |
|
707 def test_change_attribute_type(self): |
|
708 with self.mh() as (cnx, mh): |
|
709 mh.cmd_create_entity('Societe', tel=1) |
|
710 mh.commit() |
|
711 mh.change_attribute_type('Societe', 'tel', 'Float') |
|
712 self.assertNotIn(('Societe', 'Int'), self.schema['tel'].rdefs) |
|
713 self.assertIn(('Societe', 'Float'), self.schema['tel'].rdefs) |
|
714 self.assertEqual(self.schema['tel'].rdefs[('Societe', 'Float')].object, 'Float') |
|
715 tel = mh.rqlexec('Any T WHERE X tel T')[0][0] |
|
716 self.assertEqual(tel, 1.0) |
|
717 self.assertIsInstance(tel, float) |
|
718 |
707 |
719 |
708 class MigrationCommandsComputedTC(MigrationTC): |
720 class MigrationCommandsComputedTC(MigrationTC): |
709 """ Unit tests for computed relations and attributes |
721 """ Unit tests for computed relations and attributes |
710 """ |
722 """ |
711 appid = 'datacomputed' |
723 appid = 'datacomputed' |