@@ -93,9 +93,15 @@ def _get_tables_info_mock(self):
9393 )
9494 yield m
9595
96+ @pytest .yield_fixture
97+ def _get_enums_data_mock (self ):
98+ with patch ('sqlalchemydiff.comparer._get_enums_data' ) as m :
99+ m .return_value = []
100+ yield m
101+
96102 def test_compare_calls_chain (
97103 self , _get_tables_info_mock , _get_tables_data_mock ,
98- _compile_errors_mock ):
104+ _get_enums_data_mock , _compile_errors_mock ):
99105 """By inspecting `info` and `errors` at the end, we automatically
100106 check that the whole process works as expected. What this test
101107 leaves out is the verifications about inspectors.
@@ -134,6 +140,12 @@ def test_compare_calls_chain(
134140 'data' : 'some-data-B' ,
135141 },
136142 },
143+ 'enums' : {
144+ 'left_only' : [],
145+ 'right_only' : [],
146+ 'common' : [],
147+ 'diff' : [],
148+ },
137149 }
138150
139151 expected_errors = expected_info .copy ()
@@ -144,7 +156,8 @@ def test_compare_calls_chain(
144156
145157 def test__get_tables_info_called_with_correct_inspectors (
146158 self , _get_inspectors_mock , _get_tables_info_mock ,
147- _get_tables_data_mock , _compile_errors_mock ):
159+ _get_tables_data_mock , _get_enums_data_mock ,
160+ _compile_errors_mock ):
148161 left_inspector , right_inspector = _get_inspectors_mock .return_value
149162
150163 compare ("left_uri" , "right_uri" , ignores = ['ignore_me' ])
@@ -219,6 +232,11 @@ def _get_columns_info_mock(self):
219232 with patch ('sqlalchemydiff.comparer._get_columns_info' ) as m :
220233 yield m
221234
235+ @pytest .yield_fixture
236+ def _get_constraints_info_mock (self ):
237+ with patch ('sqlalchemydiff.comparer._get_constraints_info' ) as m :
238+ yield m
239+
222240 # TESTS
223241
224242 def test__get_inspectors (self ):
@@ -302,6 +320,7 @@ def test__get_info_dict(self):
302320 'common' : ['C' ],
303321 },
304322 'tables_data' : {},
323+ 'enums' : {},
305324 }
306325
307326 assert expected_info == info
@@ -616,7 +635,8 @@ def test_process_type(self):
616635
617636 def test__get_table_data (
618637 self , _get_foreign_keys_info_mock , _get_primary_keys_info_mock ,
619- _get_indexes_info_mock , _get_columns_info_mock ):
638+ _get_indexes_info_mock , _get_columns_info_mock ,
639+ _get_constraints_info_mock ):
620640 left_inspector , right_inspector = Mock (), Mock ()
621641
622642 _get_foreign_keys_info_mock .return_value = {
@@ -631,6 +651,9 @@ def test__get_table_data(
631651 _get_columns_info_mock .return_value = {
632652 'left_only' : 13 , 'right_only' : 14 , 'common' : 15 , 'diff' : 16
633653 }
654+ _get_constraints_info_mock .return_value = {
655+ 'left_only' : 17 , 'right_only' : 18 , 'common' : 19 , 'diff' : 20
656+ }
634657
635658 result = _get_table_data (
636659 left_inspector , right_inspector , 'table_A' , Mock ()
@@ -661,6 +684,12 @@ def test__get_table_data(
661684 'common' : 15 ,
662685 'diff' : 16 ,
663686 },
687+ 'constraints' : {
688+ 'left_only' : 17 ,
689+ 'right_only' : 18 ,
690+ 'common' : 19 ,
691+ 'diff' : 20 ,
692+ },
664693 }
665694
666695 assert expected_result == result
@@ -704,6 +733,12 @@ def test__compile_errors_with_errors(self):
704733 'right_only' : 14 ,
705734 'common' : 15 ,
706735 'diff' : 16 ,
736+ },
737+ 'constraints' : {
738+ 'left_only' : 17 ,
739+ 'right_only' : 18 ,
740+ 'common' : 19 ,
741+ 'diff' : 20 ,
707742 }
708743 },
709744
@@ -731,8 +766,20 @@ def test__compile_errors_with_errors(self):
731766 'right_only' : 14 ,
732767 'common' : 15 ,
733768 'diff' : 16 ,
769+ },
770+ 'constraints' : {
771+ 'left_only' : 17 ,
772+ 'right_only' : 18 ,
773+ 'common' : 19 ,
774+ 'diff' : 20 ,
734775 }
735776 }
777+ },
778+ 'enums' : {
779+ 'left_only' : 21 ,
780+ 'right_only' : 22 ,
781+ 'common' : 23 ,
782+ 'diff' : 24 ,
736783 }
737784 }
738785
@@ -766,6 +813,11 @@ def test__compile_errors_with_errors(self):
766813 'left_only' : 13 ,
767814 'right_only' : 14 ,
768815 'diff' : 16 ,
816+ },
817+ 'constraints' : {
818+ 'left_only' : 17 ,
819+ 'right_only' : 18 ,
820+ 'diff' : 20 ,
769821 }
770822 },
771823
@@ -789,8 +841,18 @@ def test__compile_errors_with_errors(self):
789841 'left_only' : 13 ,
790842 'right_only' : 14 ,
791843 'diff' : 16 ,
844+ },
845+ 'constraints' : {
846+ 'left_only' : 17 ,
847+ 'right_only' : 18 ,
848+ 'diff' : 20 ,
792849 }
793850 }
851+ },
852+ 'enums' : {
853+ 'left_only' : 21 ,
854+ 'right_only' : 22 ,
855+ 'diff' : 24 ,
794856 }
795857 }
796858
@@ -837,7 +899,19 @@ def test__compile_errors_without_errors(self):
837899 'common' : 4 ,
838900 'diff' : [],
839901 },
902+ 'constraints' : {
903+ 'left_only' : [],
904+ 'right_only' : [],
905+ 'common' : 5 ,
906+ 'diff' : [],
907+ },
840908 }
909+ },
910+ 'enums' : {
911+ 'left_only' : [],
912+ 'right_only' : [],
913+ 'common' : 6 ,
914+ 'diff' : [],
841915 }
842916 }
843917
0 commit comments