Exemplo n.º 1
0
 def test_band_datarame(self):
     start = Startup()
     bar = Bar()
     filename = 'data\\bechdel_data.json'
     df = start.load_from_file(filename)
     df = bar.band_dataframe(df, 'imdbRating')
     self.assertGreater(df.shape[1], 0)
Exemplo n.º 2
0
 def test_get_bar_json(self):
     start = Startup()
     bar = Bar()
     filename = 'data\\bechdel_data.json'
     df = start.load_from_file(filename)
     json = bar.get_bar_json(df, 'imdbRating', 'Total', 'Bechdel')
     print(json)
Exemplo n.º 3
0
 def test_load_sql(self):
     start = Startup()
     sql = '''select Year, AwardScore, Bechdel, Gross, Budget, Metascore, Rated, a.Title, Released, imdbRating
                        from bechdel a
                        join movie_info b
                          on a.imdb_id = b.imdb_id'''
     df = start.load_from_database(sql)
     self.assertGreater(df.shape[1], 0)
Exemplo n.º 4
0
 def test_get_scatter_json(self):
     start = Startup()
     scatter = Scatter()
     filename = 'data\\bechdel_data.json'
     df = start.load_from_file(filename)
     json = scatter.get_scatter_json(df, 'imdbRating', 'Metascore',
                                     'Bechdel', 'Title')
     print(json)
Exemplo n.º 5
0
 def test_aggregate_dataframe(self):
     start = Startup()
     bar = Bar()
     filename = 'data\\bechdel_data.json'
     df = start.load_from_file(filename)
     df = bar.band_dataframe(df, 'imdbRating')
     df = bar.group_dataframe(df, 'imdbRating', 'Bechdel')
     df = bar.aggregate_dataframe(df, 'imdbRating', 'Bechdel')
     self.assertEqual(df.shape[1], 3)
     self.assertLess(df.shape[0], 25)
Exemplo n.º 6
0
 def test_load_data(self):
     start = Startup()
     type = 'file'
     location = 'data\\bechdel_data.json'
     df = start.load_data(location, type)
     self.assertGreater(df.shape[1], 0)
     type = 'sql'
     location = '''select Year, AwardScore, Bechdel, Gross, Budget, Metascore, Rated, a.Title, Released, imdbRating
                      from bechdel a
                      join movie_info b
                        on a.imdb_id = b.imdb_id'''
     df = start.load_data(location, type)
     self.assertGreater(df.shape[1], 0)
Exemplo n.º 7
0
 def test_get_metadata(self):
     start = Startup()
     filename = 'data\\bechdel_data.json'
     df = start.load_from_file(filename)
     meta = start.get_metadata(df)
     self.assertEqual(meta['title'], 'Bechdel Analysis')
     self.assertEqual(meta['bar'], [
         "Rated", "AwardScore", "Year", "Bechdel", "Metascore", "Budget",
         "imdbRating", "Gross"
     ])
     self.assertEqual(meta['scatter'], [
         "AwardScore", "Year", "Bechdel", "Metascore", "Budget",
         "imdbRating", "Gross"
     ])
     self.assertEqual(meta['z'], ["Rated", "Year", "Bechdel"])
     self.assertEqual(meta['index'], 'Title')
Exemplo n.º 8
0
 def test_load_file(self):
     start = Startup()
     filename = 'data\\bechdel_data.json'
     df = start.load_from_file(filename)
     self.assertGreater(df.shape[1], 0)