Exemple #1
0
 def test_filesDiffer_withNoVarsAnalyzed(self):
     var_char = NetcdfVariableFake(np.array(['a', 'b', 'c']),
                                   is_numeric=False)
     file1 = NetcdfFileFake(self.FILENAME1, variables={'var1': var_char})
     file2 = NetcdfFileFake(self.FILENAME2, variables={'var1': var_char})
     mydiffs = FileDiffs(file1, file2, separate_dim=None)
     differ = mydiffs.files_differ()
     self.assertTrue(differ)
 def test_filesDiffer_withNoVariables(self):
     file1 = NetcdfFileFake(
         self.FILENAME1,
         variables = {})
     file2 = NetcdfFileFake(
         self.FILENAME2,
         variables = {})
     mydiffs = FileDiffs(file1, file2)
     differ = mydiffs.files_differ()
     self.assertTrue(differ)
 def test_filesDiffer_withDimsDiffer(self):
     file1 = NetcdfFileFake(
         self.FILENAME1,
         variables = {'var1': NetcdfVariableFake(np.array([1,2,3]))})
     file2 = NetcdfFileFake(
         self.FILENAME2,
         variables = {'var1': NetcdfVariableFake(np.array([1,2]))})
     mydiffs = FileDiffs(file1, file2, separate_dim=None)
     differ = mydiffs.files_differ()
     self.assertTrue(differ)
Exemple #4
0
 def test_filesDiffer_withDimsDiffer(self):
     file1 = NetcdfFileFake(
         self.FILENAME1,
         variables={'var1': NetcdfVariableFake(np.array([1, 2, 3]))})
     file2 = NetcdfFileFake(
         self.FILENAME2,
         variables={'var1': NetcdfVariableFake(np.array([1, 2]))})
     mydiffs = FileDiffs(file1, file2, separate_dim=None)
     differ = mydiffs.files_differ()
     self.assertTrue(differ)
 def test_filesDiffer_withNoVarsAnalyzed(self):
     var_char = NetcdfVariableFake(np.array(['a','b','c']), is_numeric=False)
     file1 = NetcdfFileFake(
         self.FILENAME1,
         variables = {'var1': var_char})
     file2 = NetcdfFileFake(
         self.FILENAME2,
         variables = {'var1': var_char})
     mydiffs = FileDiffs(file1, file2, separate_dim=None)
     differ = mydiffs.files_differ()
     self.assertTrue(differ)
 def test_filesDiffer_withDifferentVars(self):
     # Files with different variables should differ
     data = np.array([1,2,3,4])
     file1 = NetcdfFileFake(
         self.FILENAME1,
         # Tuples with only one string must have a comma appended
         variables = {'var1': NetcdfVariableFake(data, ('dim',))})
     file2 = NetcdfFileFake(
         self.FILENAME2,
         variables = {'var4': NetcdfVariableFake(data, ('dim',))})
     mydiffs = FileDiffs(file1, file2, separate_dim='dim2')
     differ = mydiffs.files_differ()
     self.assertTrue(differ)
 def test_filesDiffer_withDifferentSlices(self):
     # Files with variables with different slices should also differ
     data1 = np.array([[1,2,3,4],[5,6,7,8]])
     data2 = np.array([[1,2],[5,6]])
     file1 = NetcdfFileFake(
         self.FILENAME1,
         variables = {'var1': NetcdfVariableFake(data1, ('dim1', 'dim2'))})
     file2 = NetcdfFileFake(
         self.FILENAME2,
         variables = {'var1': NetcdfVariableFake(data2, ('dim1', 'dim2'))})
     mydiffs = FileDiffs(file1, file2, separate_dim='dim2')
     differ = mydiffs.files_differ()
     self.assertTrue(differ)
Exemple #8
0
 def test_filesDiffer_withDifferentVars(self):
     # Files with different variables should differ
     data = np.array([1, 2, 3, 4])
     file1 = NetcdfFileFake(
         self.FILENAME1,
         # Tuples with only one string must have a comma appended
         variables={'var1': NetcdfVariableFake(data, ('dim', ))})
     file2 = NetcdfFileFake(
         self.FILENAME2,
         variables={'var4': NetcdfVariableFake(data, ('dim', ))})
     mydiffs = FileDiffs(file1, file2, separate_dim='dim2')
     differ = mydiffs.files_differ()
     self.assertTrue(differ)
Exemple #9
0
 def test_filesDiffer_withDifferentSlices(self):
     # Files with variables with different slices should also differ
     data1 = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])
     data2 = np.array([[1, 2], [5, 6]])
     file1 = NetcdfFileFake(
         self.FILENAME1,
         variables={'var1': NetcdfVariableFake(data1, ('dim1', 'dim2'))})
     file2 = NetcdfFileFake(
         self.FILENAME2,
         variables={'var1': NetcdfVariableFake(data2, ('dim1', 'dim2'))})
     mydiffs = FileDiffs(file1, file2, separate_dim='dim2')
     differ = mydiffs.files_differ()
     self.assertTrue(differ)
Exemple #10
0
 def test_filesDiffer_withNoVariables(self):
     file1 = NetcdfFileFake(self.FILENAME1, variables={})
     file2 = NetcdfFileFake(self.FILENAME2, variables={})
     mydiffs = FileDiffs(file1, file2)
     differ = mydiffs.files_differ()
     self.assertTrue(differ)