Skip to content
This repository
Browse code

Fixing whitespace

  • Loading branch information...
commit 51e0d8ddc2d3114d7e38a68981d67cf984e110f4 1 parent fa33029
Charles Leifer authored May 10, 2012

Showing 2 changed files with 26 additions and 26 deletions. Show diff stats Hide diff stats

  1. 2  peewee.py
  2. 50  tests.py
2  peewee.py
@@ -2699,4 +2699,4 @@ def refresh(self, *fields):
2699 2699
         obj = self.select(fields).get(**{self._meta.pk_name: self.get_pk()})
2700 2700
 
2701 2701
         for field_name in fields:
2702  
-            setattr(self, field_name, getattr(obj, field_name))
  2702
+            setattr(self, field_name, getattr(obj, field_name))
50  tests.py
@@ -179,7 +179,7 @@ class RelNonIntPK(TestModel):
179 179
 class CustomPKColumn(TestModel):
180 180
     custom_pk = PrimaryKeyField(db_column='pk')
181 181
     xxx = CharField(default='')
182  
-    
  182
+
183 183
 class CPKRel(TestModel):
184 184
     custom = ForeignKeyField(CustomPKColumn)
185 185
 
@@ -1872,22 +1872,22 @@ def test_iterator(self):
1872 1872
         qr = Blog.select().where(title='xxxx').execute()
1873 1873
         titles = [b.title for b in qr.iterator()]
1874 1874
         self.assertEqual(titles, [])
1875  
-    
  1875
+
1876 1876
     def test_naive_query(self):
1877 1877
         b1 = Blog.create(title='b1')
1878 1878
         b2 = Blog.create(title='b2')
1879  
-        
  1879
+
1880 1880
         e11 = Entry.create(title='e11', blog=b1)
1881 1881
         e21 = Entry.create(title='e21', blog=b2)
1882 1882
         e22 = Entry.create(title='e22', blog=b2)
1883  
-        
  1883
+
1884 1884
         # attr assignment works in the simple case
1885 1885
         sq = Blog.select().order_by('id').naive()
1886 1886
         self.assertEqual(dict((b.id, b.title) for b in sq), {
1887 1887
             b1.id: 'b1',
1888 1888
             b2.id: 'b2',
1889 1889
         })
1890  
-        
  1890
+
1891 1891
         # aggregate assignment works as expected
1892 1892
         sq = Blog.select({
1893 1893
             Blog: ['id', 'title'],
@@ -1897,7 +1897,7 @@ def test_naive_query(self):
1897 1897
             b1.id: ['b1', 1],
1898 1898
             b2.id: ['b2', 2],
1899 1899
         })
1900  
-        
  1900
+
1901 1901
         # select related gets flattened
1902 1902
         sq = Entry.select({
1903 1903
             Entry: ['pk', 'title'],
@@ -1908,7 +1908,7 @@ def test_naive_query(self):
1908 1908
             e21.pk: ['e21', 'b2'],
1909 1909
             e22.pk: ['e22', 'b2'],
1910 1910
         })
1911  
-        
  1911
+
1912 1912
         # check that it works right when you're using a different underlying col
1913 1913
         lb1 = LegacyBlog.create(name='lb1')
1914 1914
         lb2 = LegacyBlog.create(name='lb2')
@@ -2847,17 +2847,17 @@ def test_bigint_field(self):
2847 2847
         nm1 = NullModel.create(bigint_field=1000000000000)
2848 2848
         from_db = NullModel.get(id=nm1.id)
2849 2849
         self.assertEqual(from_db.bigint_field, 1000000000000)
2850  
-    
  2850
+
2851 2851
     def test_date_and_time_fields(self):
2852 2852
         dt1 = datetime.datetime(2011, 1, 2, 11, 12, 13, 54321)
2853 2853
         dt2 = datetime.datetime(2011, 1, 2, 11, 12, 13)
2854 2854
         d1 = datetime.date(2011, 1, 3)
2855 2855
         t1 = datetime.time(11, 12, 13, 54321)
2856 2856
         t2 = datetime.time(11, 12, 13)
2857  
-        
  2857
+
2858 2858
         nm1 = NullModel.create(datetime_field=dt1, date_field=d1, time_field=t1)
2859 2859
         nm2 = NullModel.create(datetime_field=dt2, time_field=t2)
2860  
-        
  2860
+
2861 2861
         nmf1 = NullModel.get(id=nm1.id)
2862 2862
         self.assertEqual(nmf1.date_field, d1)
2863 2863
         if BACKEND == 'mysql':
@@ -2867,7 +2867,7 @@ def test_date_and_time_fields(self):
2867 2867
         else:
2868 2868
             self.assertEqual(nmf1.datetime_field, dt1)
2869 2869
             self.assertEqual(nmf1.time_field, t1)
2870  
-        
  2870
+
2871 2871
         nmf2 = NullModel.get(id=nm2.id)
2872 2872
         self.assertEqual(nmf2.datetime_field, dt2)
2873 2873
         self.assertEqual(nmf2.time_field, t2)
@@ -2933,12 +2933,12 @@ def setUp(self):
2933 2933
         CustomPKColumn.drop_table(True)
2934 2934
         CustomPKColumn.create_table()
2935 2935
         CPKRel.create_table()
2936  
-    
  2936
+
2937 2937
     def tearDown(self):
2938 2938
         super(CustomPKColumnTestCase, self).tearDown()
2939 2939
         CPKRel.drop_table(True)
2940 2940
         CustomPKColumn.drop_table(True)
2941  
-    
  2941
+
2942 2942
     def get_last(self, n=1):
2943 2943
         return [x.msg for x in self.qh.queries[-n:]]
2944 2944
 
@@ -2954,7 +2954,7 @@ def test_create_sql(self):
2954 2954
     def test_joining(self):
2955 2955
         sq = CPKRel.select().join(CustomPKColumn)
2956 2956
         self.assertSQLEqual(sq.sql(), ('SELECT t1.`id`, t1.`custom_id` FROM `cpkrel` AS t1 INNER JOIN `custompkcolumn` AS t2 ON t1.`custom_id` = t2.`pk`', []))
2957  
-        
  2957
+
2958 2958
         sq = CustomPKColumn.select().join(CPKRel)
2959 2959
         self.assertSQLEqual(sq.sql(), ('SELECT t1.`pk`, t1.`xxx` FROM `custompkcolumn` AS t1 INNER JOIN `cpkrel` AS t2 ON t1.`pk` = t2.`custom_id`', []))
2960 2960
 
@@ -2963,49 +2963,49 @@ def test_model_operations(self):
2963 2963
         self.assertSQLEqual(self.get_last()[0], (
2964 2964
             'INSERT INTO `custompkcolumn` (`xxx`) VALUES (?)', ['']
2965 2965
         ))
2966  
-        
  2966
+
2967 2967
         self.assertEqual(CustomPKColumn.select().count(), 1)
2968 2968
         self.assertSQLEqual(self.get_last()[0], (
2969 2969
             'SELECT COUNT(pk) FROM `custompkcolumn`', []
2970 2970
         ))
2971  
-        
  2971
+
2972 2972
         cpk.save()
2973 2973
         self.assertSQLEqual(self.get_last()[0], (
2974 2974
             'UPDATE `custompkcolumn` SET `xxx`=? WHERE `pk` = ?', ['', cpk.get_pk()]
2975 2975
         ))
2976 2976
         self.assertEqual(CustomPKColumn.select().count(), 1)
2977  
-        
  2977
+
2978 2978
         sq = CustomPKColumn.select('custom_pk')
2979 2979
         self.assertSQLEqual(sq.sql(), ('SELECT `pk` FROM `custompkcolumn`', []))
2980  
-        
  2980
+
2981 2981
         res = sq.get()
2982 2982
         self.assertEqual(res.custom_pk, cpk.get_pk())
2983  
-        
  2983
+
2984 2984
         cpk_rel = CPKRel.create(custom=cpk)
2985 2985
         self.assertSQLEqual(self.get_last()[0], (
2986 2986
             'INSERT INTO `cpkrel` (`custom_id`) VALUES (?)', [cpk.get_pk()]
2987 2987
         ))
2988  
-        
  2988
+
2989 2989
         from_db = CPKRel.get(id=cpk_rel.id)
2990 2990
         self.assertEqual(from_db.custom, cpk)
2991 2991
         self.assertSQLEqual(self.get_last()[0], (
2992 2992
             'SELECT `pk`, `xxx` FROM `custompkcolumn` WHERE `pk` = ? LIMIT 1', [cpk.get_pk()]
2993 2993
         ))
2994 2994
         self.assertTrue(from_db.custom.custom_pk == cpk.get_pk() == cpk.custom_pk)
2995  
-        
  2995
+
2996 2996
         cpk = CustomPKColumn.create()
2997 2997
         pk = cpk.get_pk()
2998  
-        
  2998
+
2999 2999
         cpk.delete_instance()
3000 3000
         self.assertSQLEqual(self.get_last()[0], (
3001 3001
             'DELETE FROM `custompkcolumn` WHERE `pk` = ?', [pk]
3002 3002
         ))
3003  
-    
  3003
+
3004 3004
     def test_subquery(self):
3005 3005
         cpk_q = CustomPKColumn.select().where(xxx='faps')
3006 3006
         cpk_rel_q = CPKRel.select().where(custom__in=cpk_q)
3007 3007
         self.assertSQLEqual(cpk_rel_q.sql(), ('SELECT `id`, `custom_id` FROM `cpkrel` WHERE `custom_id` IN (SELECT t1.`pk` FROM `custompkcolumn` AS t1 WHERE t1.`xxx` = ?)', ['faps']))
3008  
-    
  3008
+
3009 3009
     def test_annotate(self):
3010 3010
         sq = CPKRel.select().annotate(CustomPKColumn)
3011 3011
         self.assertSQLEqual(sq.sql(), ('SELECT t1.`id`, t1.`custom_id`, COUNT(t2.`pk`) AS count FROM `cpkrel` AS t1 INNER JOIN `custompkcolumn` AS t2 ON t1.`custom_id` = t2.`pk` GROUP BY t1.`id`, t1.`custom_id`', []))
@@ -3485,4 +3485,4 @@ def test_sequence_shared(self):
3485 3485
             self.assertEqual(b2.id, a3.id - 1)
3486 3486
 
3487 3487
 else:
3488  
-    print 'Skipping sequence tests because backend does not support'
  3488
+    print 'Skipping sequence tests because backend does not support'

0 notes on commit 51e0d8d

Please sign in to comment.
Something went wrong with that request. Please try again.