Exemplo n.º 1
0
    def test_exposures_string_is_provided___file_content_is_loaded(self, data):
        stream = StringIO()
        data = [('first', 'second')] + data

        csv.writer(stream).writerows(data)

        res = OasisLookupFactory.get_model_exposures(
            model_exposures=stream.getvalue())
        res = [tuple(res)] + [tuple(res.iloc[i]) for i in range(len(res))]

        self.assertEqual(res, data)
Exemplo n.º 2
0
    def test_file_is_provided___file_content_is_loaded(self, data):
        data = [('first', 'second')] + data

        with NamedTemporaryFile('w') as f:
            csv.writer(f).writerows(data)
            f.flush()

            res = OasisLookupFactory.get_model_exposures(
                model_exposures_file_path=f.name)
            res = [tuple(res)] + [tuple(res.iloc[i]) for i in range(len(res))]

            self.assertEqual(res, data)
Exemplo n.º 3
0
 def test_no_file_or_exposures_are_provided___oasis_exception_is_raised(
         self):
     with self.assertRaises(OasisException):
         OasisLookupFactory.get_model_exposures()