Beispiel #1
0
 def test_validate_dataframes_valid(self):
     df1 = {
         'Unknown': {
             'sink1': 0.25,
             'sink2': 0.25
         },
         'Source1': {
             'sink1': 0.50,
             'sink2': 0.25
         },
         'Source2': {
             'sink1': 0.25,
             'sink2': 0.25
         }
     }
     df1 = pd.DataFrame(df1)
     df2 = {
         'Unknown': {
             'sink1': 0.1,
             'sink2': 0.25
         },
         'Source1': {
             'sink1': 0.1,
             'sink2': 0.25
         },
         'Source2': {
             'sink1': 0.8,
             'sink2': 0.25
         }
     }
     df2 = pd.DataFrame(df2)
     _validate_dataframes(df1, df2)
Beispiel #2
0
 def test_validate_dataframes_valid(self):
     df1 = {'Unknown': {'sink1': 0.25, 'sink2': 0.25},
            'Source1': {'sink1': 0.50, 'sink2': 0.25},
            'Source2': {'sink1': 0.25, 'sink2': 0.25}}
     df1 = pd.DataFrame(df1)
     df2 = {'Unknown': {'sink1': 0.1, 'sink2': 0.25},
            'Source1': {'sink1': 0.1, 'sink2': 0.25},
            'Source2': {'sink1': 0.8, 'sink2': 0.25}}
     df2 = pd.DataFrame(df2)
     _validate_dataframes(df1, df2)
Beispiel #3
0
    def test_validate_dataframes_invalid_sources(self):
        df1 = {'Hello': {'sink1': 0.25, 'sink2': 0.25},
               'Source1': {'sink1': 0.50, 'sink2': 0.25},
               'Source2': {'sink1': 0.25, 'sink2': 0.25}}
        df1 = pd.DataFrame(df1)
        df2 = {'Unknown': {'sink1': 0.1, 'sink2': 0.25},
               'Source1': {'sink1': 0.1, 'sink2': 0.25},
               'Source2': {'sink1': 0.8, 'sink2': 0.25}}
        df2 = pd.DataFrame(df2)
        with self.assertRaises(ValueError):
            _validate_dataframes(df1, df2)

        df1 = {'Source1': {'sink1': 0.50, 'sink2': 0.25},
               'Source2': {'sink1': 0.50, 'sink2': 0.25}}
        df1 = pd.DataFrame(df1)
        df2 = {'Unknown': {'sink1': 0.1, 'sink2': 0.25},
               'Source1': {'sink1': 0.1, 'sink2': 0.25},
               'Source2': {'sink1': 0.8, 'sink2': 0.25}}
        df2 = pd.DataFrame(df2)
        with self.assertRaises(ValueError):
            _validate_dataframes(df1, df2)
Beispiel #4
0
    def test_validate_dataframes_invalid_sources(self):
        df1 = {
            'Hello': {
                'sink1': 0.25,
                'sink2': 0.25
            },
            'Source1': {
                'sink1': 0.50,
                'sink2': 0.25
            },
            'Source2': {
                'sink1': 0.25,
                'sink2': 0.25
            }
        }
        df1 = pd.DataFrame(df1)
        df2 = {
            'Unknown': {
                'sink1': 0.1,
                'sink2': 0.25
            },
            'Source1': {
                'sink1': 0.1,
                'sink2': 0.25
            },
            'Source2': {
                'sink1': 0.8,
                'sink2': 0.25
            }
        }
        df2 = pd.DataFrame(df2)
        with self.assertRaises(ValueError):
            _validate_dataframes(df1, df2)

        df1 = {
            'Source1': {
                'sink1': 0.50,
                'sink2': 0.25
            },
            'Source2': {
                'sink1': 0.50,
                'sink2': 0.25
            }
        }
        df1 = pd.DataFrame(df1)
        df2 = {
            'Unknown': {
                'sink1': 0.1,
                'sink2': 0.25
            },
            'Source1': {
                'sink1': 0.1,
                'sink2': 0.25
            },
            'Source2': {
                'sink1': 0.8,
                'sink2': 0.25
            }
        }
        df2 = pd.DataFrame(df2)
        with self.assertRaises(ValueError):
            _validate_dataframes(df1, df2)