@@ -612,7 +612,7 @@ class _Common__check_attribute_compliance:
612612
613613    def  setUp (self ):
614614        self .container  =  mock .Mock (name = "container" , attributes = {})
615-         self .data  =  self . array_lib . array ( 1 ,  dtype = "int32" )
615+         self .data_dtype  =  np . dtype ( "int32" )
616616
617617        patch  =  mock .patch ("netCDF4.Dataset" )
618618        _  =  patch .start ()
@@ -629,7 +629,7 @@ def assertAttribute(self, value):
629629    def  check_attribute_compliance_call (self , value ):
630630        self .set_attribute (value )
631631        with  Saver (mock .Mock (), "NETCDF4" ) as  saver :
632-             saver .check_attribute_compliance (self .container , self .data )
632+             saver .check_attribute_compliance (self .container , self .data_dtype )
633633
634634
635635class  Test_check_attribute_compliance__valid_range (
@@ -642,10 +642,10 @@ def attribute(self):
642642    def  test_valid_range_type_coerce (self ):
643643        value  =  self .array_lib .array ([1 , 2 ], dtype = "float" )
644644        self .check_attribute_compliance_call (value )
645-         self .assertAttribute (self .data . dtype )
645+         self .assertAttribute (self .data_dtype )
646646
647647    def  test_valid_range_unsigned_int8_data_signed_range (self ):
648-         self .data  =  self . data . astype ("uint8" )
648+         self .data_dtype  =  np . dtype ("uint8" )
649649        value  =  self .array_lib .array ([1 , 2 ], dtype = "int8" )
650650        self .check_attribute_compliance_call (value )
651651        self .assertAttribute (value .dtype )
@@ -658,7 +658,7 @@ def test_valid_range_cannot_coerce(self):
658658
659659    def  test_valid_range_not_numpy_array (self ):
660660        # Ensure we handle the case when not a numpy array is provided. 
661-         self .data  =  self . data . astype ("int8" )
661+         self .data_dtype  =  np . dtype ("int8" )
662662        value  =  [1 , 2 ]
663663        self .check_attribute_compliance_call (value )
664664        self .assertAttribute (np .int64 )
@@ -674,10 +674,10 @@ def attribute(self):
674674    def  test_valid_range_type_coerce (self ):
675675        value  =  self .array_lib .array (1 , dtype = "float" )
676676        self .check_attribute_compliance_call (value )
677-         self .assertAttribute (self .data . dtype )
677+         self .assertAttribute (self .data_dtype )
678678
679679    def  test_valid_range_unsigned_int8_data_signed_range (self ):
680-         self .data  =  self . data . astype ("uint8" )
680+         self .data_dtype  =  np . dtype ("uint8" )
681681        value  =  self .array_lib .array (1 , dtype = "int8" )
682682        self .check_attribute_compliance_call (value )
683683        self .assertAttribute (value .dtype )
@@ -690,7 +690,7 @@ def test_valid_range_cannot_coerce(self):
690690
691691    def  test_valid_range_not_numpy_array (self ):
692692        # Ensure we handle the case when not a numpy array is provided. 
693-         self .data  =  self . data . astype ("int8" )
693+         self .data_dtype  =  np . dtype ("int8" )
694694        value  =  1 
695695        self .check_attribute_compliance_call (value )
696696        self .assertAttribute (np .int64 )
@@ -706,10 +706,10 @@ def attribute(self):
706706    def  test_valid_range_type_coerce (self ):
707707        value  =  self .array_lib .array (2 , dtype = "float" )
708708        self .check_attribute_compliance_call (value )
709-         self .assertAttribute (self .data . dtype )
709+         self .assertAttribute (self .data_dtype )
710710
711711    def  test_valid_range_unsigned_int8_data_signed_range (self ):
712-         self .data  =  self . data . astype ("uint8" )
712+         self .data_dtype  =  np . dtype ("uint8" )
713713        value  =  self .array_lib .array (2 , dtype = "int8" )
714714        self .check_attribute_compliance_call (value )
715715        self .assertAttribute (value .dtype )
@@ -722,7 +722,7 @@ def test_valid_range_cannot_coerce(self):
722722
723723    def  test_valid_range_not_numpy_array (self ):
724724        # Ensure we handle the case when not a numpy array is provided. 
725-         self .data  =  self . data . astype ("int8" )
725+         self .data_dtype  =  np . dtype ("int8" )
726726        value  =  2 
727727        self .check_attribute_compliance_call (value )
728728        self .assertAttribute (np .int64 )
@@ -733,13 +733,15 @@ class Test_check_attribute_compliance__exception_handling(
733733):
734734    def  test_valid_range_and_valid_min_valid_max_provided (self ):
735735        # Conflicting attributes should raise a suitable exception. 
736-         self .data  =  self . data . astype ("int8" )
736+         self .data_dtype  =  np . dtype ("int8" )
737737        self .container .attributes ["valid_range" ] =  [1 , 2 ]
738738        self .container .attributes ["valid_min" ] =  [1 ]
739739        msg  =  'Both "valid_range" and "valid_min"' 
740740        with  Saver (mock .Mock (), "NETCDF4" ) as  saver :
741741            with  self .assertRaisesRegex (ValueError , msg ):
742-                 saver .check_attribute_compliance (self .container , self .data )
742+                 saver .check_attribute_compliance (
743+                     self .container , self .data_dtype 
744+                 )
743745
744746
745747class  Test__cf_coord_identity (tests .IrisTest ):
0 commit comments