@@ -680,18 +680,10 @@ def test_bigquery_graph_json_result(monkeypatch):
680680 html_content = display_mock .call_args_list [0 ][0 ][0 ].data
681681 assert "<script>" in html_content
682682 assert "</script>" in html_content
683- # Verify that the query results are embedded into the HTML, allowing them to be visualized.
684- # Due to escaping, it is not possible check for graph_json_rows exactly, so we check for a few
685- # sentinel strings within the query results, instead.
683+ # Sanity check that query results are not embedded into the HTML.
686684 assert (
687- "mUZpbkdyYXBoLlBlcnNvbgB4kQI=" in html_content
685+ "mUZpbkdyYXBoLlBlcnNvbgB4kQI=" not in html_content
688686 ) # identifier in 1st row of query result
689- assert (
690- "mUZpbkdyYXBoLlBlcnNvbgB4kQY=" in html_content
691- ) # identifier in 2nd row of query result
692- assert (
693- "mUZpbkdyYXBoLlBlcnNvbgB4kQQ=" in html_content
694- ) # identifier in 3rd row of query result
695687
696688 # Make sure we can run a second graph query, after the graph server is already running.
697689 try :
@@ -704,18 +696,6 @@ def test_bigquery_graph_json_result(monkeypatch):
704696 html_content = display_mock .call_args_list [0 ][0 ][0 ].data
705697 assert "<script>" in html_content
706698 assert "</script>" in html_content
707- # Verify that the query results are embedded into the HTML, allowing them to be visualized.
708- # Due to escaping, it is not possible check for graph_json_rows exactly, so we check for a few
709- # sentinel strings within the query results, instead.
710- assert (
711- "mUZpbkdyYXBoLlBlcnNvbgB4kQI=" in html_content
712- ) # identifier in 1st row of query result
713- assert (
714- "mUZpbkdyYXBoLlBlcnNvbgB4kQY=" in html_content
715- ) # identifier in 2nd row of query result
716- assert (
717- "mUZpbkdyYXBoLlBlcnNvbgB4kQQ=" in html_content
718- ) # identifier in 3rd row of query result
719699
720700 assert bqstorage_mock .called # BQ storage client was used
721701 assert isinstance (return_value , pandas .DataFrame )
@@ -791,18 +771,10 @@ def test_bigquery_graph_colab(monkeypatch):
791771 html_content = display_mock .call_args_list [0 ][0 ][0 ].data
792772 assert "<script>" in html_content
793773 assert "</script>" in html_content
794- # Verify that the query results are embedded into the HTML, allowing them to be visualized.
795- # Due to escaping, it is not possible check for graph_json_rows exactly, so we check for a few
796- # sentinel strings within the query results, instead.
774+ # Verify that the query results are not embedded into the HTML.
797775 assert (
798- "mUZpbkdyYXBoLlBlcnNvbgB4kQI=" in html_content
776+ "mUZpbkdyYXBoLlBlcnNvbgB4kQI=" not in html_content
799777 ) # identifier in 1st row of query result
800- assert (
801- "mUZpbkdyYXBoLlBlcnNvbgB4kQY=" in html_content
802- ) # identifier in 2nd row of query result
803- assert (
804- "mUZpbkdyYXBoLlBlcnNvbgB4kQQ=" in html_content
805- ) # identifier in 3rd row of query result
806778
807779 # Make sure we actually used colab path, not GraphServer path.
808780 assert sys .modules ["google.colab" ].output .register_callback .called
@@ -818,6 +790,7 @@ def test_bigquery_graph_colab(monkeypatch):
818790 reason = "Requires `spanner-graph-notebook` and `google-cloud-bigquery-storage`" ,
819791)
820792def test_colab_query_callback ():
793+ graph_server .graph_server .query_result = pandas .DataFrame ([], columns = ["result" ])
821794 result = bigquery_magics .bigquery ._colab_query_callback (
822795 "query" , json .dumps ({"result" : {}})
823796 )
0 commit comments