def test_psp(self):
     import pandas as pd
     from perspective import psp
     with patch('IPython.display.display') as m1:
         df = pd.DataFrame([1, 2], columns=['1'])
         psp(df)
         assert m1.call_count == 1
Beispiel #2
0
 def test_layout3(self):
     import pandas as pd
     from perspective import psp, View, PSPException
     with patch('IPython.display.display'):
         df = pd.DataFrame([1, 2], columns=['1'])
         psp(df, View.YBAR, None, '1')
         psp(df, View.YBAR, None, ['1'])
         psp(df, View.YBAR, None, ['1'], '1')
         psp(df, View.YBAR, None, ['1'], ['1'])
         try:
             psp(df, View.YBAR, ['1'], 5)
             assert False
         except PSPException:
             pass
Beispiel #3
0
 def test_layout3(self):
     import pandas as pd
     from perspective import psp, View
     with patch('IPython.display.display'):
         df = pd.DataFrame([1, 2], columns=['1'])
         psp(df, View.YBAR, None, '1')
         psp(df, View.YBAR, None, ['1'])
         psp(df, View.YBAR, None, ['1'], '1')
         psp(df, View.YBAR, None, ['1'], ['1'])
Beispiel #4
0
 def test_aggregates(self):
     import pandas as pd
     from perspective import psp, View, Aggregate, PSPException
     with patch('IPython.display.display'):
         df = pd.DataFrame([1, 2], columns=['1'])
         psp(df, View.YBAR, None, ['1'], None, ['1'], {'1': Aggregate.ANY})
         psp(df, View.YBAR, None, ['1'], None, ['1'], {'1': 'any'})
         try:
             psp(df, View.YBAR, None, ['1'], None, ['1'], {'1': 'test'})
             assert False
         except PSPException:
             pass
         try:
             psp(df, View.YBAR, None, ['1'], None, ['1'], {'1': 5})
             assert False
         except PSPException:
             pass
         try:
             psp(df, View.YBAR, None, ['1'], None, ['1'], 5)
             assert False
         except PSPException:
             pass
Beispiel #5
0
    def test_layout(self):
        import pandas as pd
        from perspective import psp, Plugin, PerspectiveError
        with patch('IPython.display.display'):
            df = pd.DataFrame([1, 2], columns=['1'])
            psp(df, Plugin.YBAR)
            psp(df, 'y_line')
            try:
                psp(df, 'test')
                assert False
            except PerspectiveError:
                pass

            try:
                psp(df, 5)
                assert False
            except PerspectiveError:
                pass
Beispiel #6
0
 def test_layout5(self):
     import pandas as pd
     from perspective import psp, Plugin, PerspectiveError
     with patch('IPython.display.display'):
         df = pd.DataFrame([1, 2], columns=['1'])
         psp(df, Plugin.YBAR, None, ['1'])
         psp(df, Plugin.YBAR, None, ['1'], None, None, None,
             [['test', 'asc']])
         try:
             psp(df, Plugin.YBAR, None, ['1'], None, None, None, 5)
             assert False
         except PerspectiveError:
             pass
Beispiel #7
0
 def test_psp(self):
     import pandas as pd
     from perspective import psp
     df = pd.DataFrame([1, 2], columns=['1'])
     psp(df)
Beispiel #8
0
def psp_grid(data, **kwargs):
    return psp(data, **kwargs)