Django

Code

Changeset 3293

Show
Ignore:
Timestamp:
07/07/06 16:31:16 (2 years ago)
Author:
jpellerin
Message:

[multi-db] Updated tests to expect pendings in dict format instead of
list.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/multiple-db-support/tests/modeltests/multiple_databases/models.py

    r3281 r3293  
    132132True 
    133133 
    134 # When not using transaction management, model save will commit only 
     134# When transactions are not managed, model save will commit only 
    135135# for the model's connection. 
    136136 
    137137>>> from django.db import transaction 
    138138>>> transaction.enter_transaction_management() 
     139>>> transaction.managed(False) 
    139140>>> a = Artist(name="Joan Miro", alive=False) 
    140141>>> w = Widget(code="99rbln", weight=1) 
  • django/branches/multiple-db-support/tests/othertests/ansi_sql.py

    r3261 r3293  
     1# For Python 2.3 
     2if not hasattr(__builtins__, 'set'): 
     3    from sets import Set as set 
     4 
    15""" 
    26>>> from django.db import models 
     
    3438>>> builder.models_already_seen 
    3539[<class 'othertests.ansi_sql.Car'>] 
    36 >>> builder.models_already_seen = [] 
     40>>> builder.models_already_seen = set() 
    3741 
    3842# test that styles are used 
     
    4145 
    4246# test pending relationships 
    43 >>> builder.models_already_seen = [] 
     47>>> builder.models_already_seen = set() 
    4448>>> real_cnst = Mod._meta.connection_info.backend.supports_constraints 
    4549>>> Mod._meta.connection_info.backend.supports_constraints = True 
    4650>>> builder.get_create_table(Mod) 
    47 ([BoundStatement('CREATE TABLE "ansi_sql_mod" (..."car_id" integer NOT NULL,...);')], [BoundStatement('ALTER TABLE "ansi_sql_mod" ADD CONSTRAINT ... FOREIGN KEY ("car_id") REFERENCES "ansi_sql_car" ("id");')]
    48 >>> builder.models_already_seen = [] 
     51([BoundStatement('CREATE TABLE "ansi_sql_mod" (..."car_id" integer NOT NULL,...);')], {<class 'othertests.ansi_sql.Car'>: [BoundStatement('ALTER TABLE "ansi_sql_mod" ADD CONSTRAINT ... FOREIGN KEY ("car_id") REFERENCES "ansi_sql_car" ("id");')]}
     52>>> builder.models_already_seen = set() 
    4953>>> builder.get_create_table(Car) 
    50 ([BoundStatement('CREATE TABLE "ansi_sql_car" (...);')], []
     54([BoundStatement('CREATE TABLE "ansi_sql_car" (...);')], {}
    5155>>> builder.get_create_table(Mod) 
    52 ([BoundStatement('CREATE TABLE "ansi_sql_mod" (..."car_id" integer NOT NULL REFERENCES "ansi_sql_car" ("id"),...);')], []
     56([BoundStatement('CREATE TABLE "ansi_sql_mod" (..."car_id" integer NOT NULL REFERENCES "ansi_sql_car" ("id"),...);')], {}
    5357>>> Mod._meta.connection_info.backend.supports_constraints = real_cnst 
    5458 
    5559# test many-many 
    5660>>> builder.get_create_table(Collector) 
    57 ([BoundStatement('CREATE TABLE "ansi_sql_collector" (...);')], []
     61([BoundStatement('CREATE TABLE "ansi_sql_collector" (...);')], {}
    5862>>> builder.get_create_many_to_many(Collector) 
    59 [BoundStatement('CREATE TABLE "ansi_sql_collector_cars" (...);')] 
     63{<class 'othertests.ansi_sql.Car'>: [BoundStatement('CREATE TABLE "ansi_sql_collector_cars" (...);')]} 
    6064 
    6165# test indexes 
  • django/branches/multiple-db-support/tests/othertests/manager_schema_manipulation.py

    r3266 r3293  
    8888 
    8989>>> DA.objects.install() 
    90 [] 
     90{} 
    9191>>> QA.objects.install() 
    92 [] 
     92{} 
    9393>>> QB.objects.install() 
    94 [] 
     94{} 
    9595>>> DA.objects.all() 
    9696[] 
     
    108108# meant to establish foreign key relationships to tables that don't 
    109109# exist. These are bound to the model's connection and should 
    110 # be executed after all models in the app have been installed. 
     110# be executed after all models in the app have been installed. The pending 
     111# statments are returned as a dict keyed by the model which must be installed 
     112# before the pending statements can be installed. 
    111113 
    112114# NOTE: pretend db supports constraints for this test 
     
    115117>>> result = PA.objects.install() 
    116118>>> result 
    117 [BoundStatement('ALTER TABLE "othertests_pa" ADD CONSTRAINT "c_id_referencing_othertests_pc_id" FOREIGN KEY ("c_id") REFERENCES "othertests_pc" ("id");')] 
     119{<class 'othertests.manager_schema_manipulation.PC'>: [BoundStatement('ALTER TABLE "othertests_pa" ADD CONSTRAINT "c_id_referencing_othertests_pc_id" FOREIGN KEY ("c_id") REFERENCES "othertests_pc" ("id");')]} 
    118120 
    119121# NOTE: restore real constraint flag 
    120122>>> PA._meta.connection_info.backend.supports_constraints = real_cnst 
    121123 
    122 # Models with many-many relationships will also have pending statement 
     124# Models with many-many relationships may also have pending statement 
    123125# lists. Like other pending statements, these should be executed after 
    124 # all models in the app have been installed. 
     126# all models in the app have been installed. If the related table's model 
     127# has already been created, then there will be no pending list. 
    125128 
    126129>>> QC.objects.install() 
    127 [] 
     130{} 
    128131>>> QD.objects.install() 
    129 [BoundStatement('CREATE TABLE "othertests_qd_qcs" (...);')] 
     132{} 
    130133 
    131134"""