def test_convert_scalar_to_float(self): migrations.enable_migrations(True) self.assertTrue( scalars_equal(self.scalar_float, migrations.maybe_get_float(self.scalar_float))) self.assertTrue( scalars_equal(self.scalar_float, migrations.maybe_get_float(self.scalar_int)))
def test_convert_list_to_float(self): migrations.enable_migrations(True) self.assertTrue( lists_equal(self.list_of_floats, migrations.maybe_get_float(self.list_of_floats))) self.assertTrue( lists_equal(self.list_of_floats, migrations.maybe_get_float(self.list_of_ints)))
def test_convert_array_to_float(self): migrations.enable_migrations(True) self.assertTrue( arrays_equal(self.array_of_floats, migrations.maybe_get_float(self.array_of_floats))) self.assertTrue( arrays_equal(self.array_of_floats, migrations.maybe_get_float(self.array_of_ints)))
def test_no_migrations(self): migrations.enable_migrations(False) self.assertTrue( arrays_equal(self.array_of_ints, migrations.maybe_get_float(self.array_of_ints))) self.assertTrue( arrays_equal(self.array_of_floats, migrations.maybe_get_float(self.array_of_floats))) self.assertTrue( lists_equal(self.list_of_ints, migrations.maybe_get_float(self.list_of_ints))) self.assertTrue( lists_equal(self.list_of_floats, migrations.maybe_get_float(self.list_of_floats))) self.assertTrue( scalars_equal(self.scalar_int, migrations.maybe_get_float(self.scalar_int))) self.assertTrue( scalars_equal(self.scalar_float, migrations.maybe_get_float(self.scalar_float))) self.assertTrue( scalars_equal(self.scalar_str, migrations.maybe_get_float(self.scalar_str)))
def tearDown(self) -> None: if self.prev_migration: migrations.enable_migrations(True) else: migrations.enable_migrations(False)
def test_bad_data(self): migrations.enable_migrations(True) self.assertTrue(scalars_equal(None, migrations.maybe_get_float(None))) self.assertTrue( scalars_equal(self.scalar_str, migrations.maybe_get_float(self.scalar_str)))