@@ -24,7 +24,7 @@ public class JupyterFormatTests : DocumentFormatTestsBase
2424{
2525 private readonly Configuration _assentConfiguration =
2626 new Configuration ( )
27- . UsingExtension ( "json " )
27+ . UsingExtension ( "ipynb " )
2828 . SetInteractive ( Debugger . IsAttached ) ;
2929
3030 public InteractiveDocument SerializeAndParse ( object jupyter )
@@ -75,17 +75,16 @@ public void notebook_metadata_default_language_is_honored_in_cells_without_langu
7575
7676 notebook . Elements
7777 . Should ( )
78- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
79- {
78+ . BeEquivalentToRespectingRuntimeTypes ( [
8079 new InteractiveDocumentElement ( "// this is the code" , language )
81- } ) ;
80+ ] ) ;
8281 }
8382
8483 [ Theory ]
8584 [ InlineData ( "C#" , "csharp" ) ]
8685 [ InlineData ( "F#" , "fsharp" ) ]
8786 [ InlineData ( "f#" , "fsharp" ) ]
88- [ InlineData ( "PowerShell" , "powershell " ) ]
87+ [ InlineData ( "PowerShell" , "pwsh " ) ]
8988 public void Metadata_default_kernel_name_is_based_on_specified_language ( string languageName , string kernelName )
9089 {
9190 var document = Notebook . Parse ( new InteractiveDocument ( ) . ToJupyterJson ( languageName ) ) ;
@@ -99,7 +98,7 @@ public void Metadata_default_kernel_name_is_based_on_specified_language(string l
9998 [ InlineData ( "C#" , "csharp" ) ]
10099 [ InlineData ( "F#" , "fsharp" ) ]
101100 [ InlineData ( "f#" , "fsharp" ) ]
102- [ InlineData ( "PowerShell" , "powershell " ) ]
101+ [ InlineData ( "PowerShell" , "pwsh " ) ]
103102 public void Metadata_default_kernel_name_is_based_on_specified_language_when_serialized_and_deserialized ( string languageName , string kernelName )
104103 {
105104 var originalDoc = Notebook . Parse ( new InteractiveDocument ( ) . ToJupyterJson ( languageName ) ) ;
@@ -139,11 +138,10 @@ public void missing_metadata_defaults_to_csharp_kernel()
139138 var notebook = SerializeAndParse ( jupyter ) ;
140139 notebook . Elements
141140 . Should ( )
142- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
143- {
141+ . BeEquivalentToRespectingRuntimeTypes ( [
144142 new InteractiveDocumentElement ( "// this is assumed to be csharp" , "csharp" ) ,
145143 new InteractiveDocumentElement ( "#!csharp\n // this is still assumed to be csharp" , "csharp" )
146- } ) ;
144+ ] ) ;
147145 }
148146
149147 [ Fact ]
@@ -355,10 +353,9 @@ public void parsed_cells_do_not_contain_redundant_language_specifier()
355353
356354 notebook . Elements
357355 . Should ( )
358- . BeEquivalentToRespectingRuntimeTypes ( new object [ ]
359- {
356+ . BeEquivalentToRespectingRuntimeTypes ( [
360357 new InteractiveDocumentElement ( "#!csharp\n // this is the code" , "csharp" )
361- } ) ;
358+ ] ) ;
362359 }
363360
364361 [ Fact ]
@@ -457,14 +454,13 @@ public void parsed_cell_language_aliases_are_normalized()
457454
458455 notebook . Elements
459456 . Should ( )
460- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
461- {
457+ . BeEquivalentToRespectingRuntimeTypes ( [
462458 new InteractiveDocumentElement ( "#!c#\n // this is csharp 1" , "csharp" ) ,
463459 new InteractiveDocumentElement ( "#!C#\n // this is csharp 2" , "csharp" ) ,
464460 new InteractiveDocumentElement ( "#!f#\n // this is fsharp 1" , "fsharp" ) ,
465461 new InteractiveDocumentElement ( "#!F#\n // this is fsharp 2" , "fsharp" ) ,
466462 new InteractiveDocumentElement ( "#!powershell\n # this is pwsh" , "pwsh" )
467- } ) ;
463+ ] ) ;
468464 }
469465
470466 [ Fact ]
@@ -506,10 +502,9 @@ public void parsed_cells_can_override_default_language_with_language_specifier()
506502
507503 notebook . Elements
508504 . Should ( )
509- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
510- {
505+ . BeEquivalentToRespectingRuntimeTypes ( [
511506 new InteractiveDocumentElement ( "#!fsharp\n // this is the code" , "fsharp" )
512- } ) ;
507+ ] ) ;
513508 }
514509
515510 [ Fact ]
@@ -551,10 +546,9 @@ public void parsed_cells_can_contain_polyglot_blobs_with_appropriate_default_lan
551546
552547 notebook . Elements
553548 . Should ( )
554- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
555- {
549+ . BeEquivalentToRespectingRuntimeTypes ( [
556550 new InteractiveDocumentElement ( "// this is csharp\n #!fsharp\n // and this is fsharp" , "csharp" )
557- } ) ;
551+ ] ) ;
558552 }
559553
560554 [ Fact ]
@@ -596,10 +590,9 @@ public void parsed_cells_create_non_language_specifier_first_lines_as_magic_comm
596590
597591 notebook . Elements
598592 . Should ( )
599- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
600- {
593+ . BeEquivalentToRespectingRuntimeTypes ( [
601594 new InteractiveDocumentElement ( "#!probably-a-magic-command\n // but this is csharp" , "csharp" )
602- } ) ;
595+ ] ) ;
603596 }
604597
605598 [ Fact ]
@@ -619,10 +612,9 @@ public void markdown_cells_can_be_parsed_as_a_single_string()
619612 var notebook = SerializeAndParse ( jupyter ) ;
620613 notebook . Elements
621614 . Should ( )
622- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
623- {
615+ . BeEquivalentToRespectingRuntimeTypes ( [
624616 new InteractiveDocumentElement ( "This is `markdown`." , "markdown" )
625- } ) ;
617+ ] ) ;
626618 }
627619
628620 [ Fact ]
@@ -646,10 +638,9 @@ public void markdown_cells_can_be_parsed_as_a_string_array()
646638 var notebook = SerializeAndParse ( jupyter ) ;
647639 notebook . Elements
648640 . Should ( )
649- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
650- {
641+ . BeEquivalentToRespectingRuntimeTypes ( [
651642 new InteractiveDocumentElement ( "This is `markdown`.\n So is this." , "markdown" )
652- } ) ;
643+ ] ) ;
653644 }
654645
655646 [ Fact ]
@@ -698,10 +689,9 @@ public void cells_can_specify_source_as_a_string_array()
698689
699690 notebook . Elements
700691 . Should ( )
701- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
702- {
692+ . BeEquivalentToRespectingRuntimeTypes ( [
703693 new InteractiveDocumentElement ( "line 1\n line 2\n line 3\n line 4" , "csharp" )
704- } ) ;
694+ ] ) ;
705695 }
706696
707697 [ Fact ]
@@ -723,10 +713,9 @@ public void cells_can_specify_source_as_a_single_string()
723713
724714 notebook . Elements
725715 . Should ( )
726- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
727- {
716+ . BeEquivalentToRespectingRuntimeTypes ( [
728717 new InteractiveDocumentElement ( "line 1\n line 2\n line 3\n " , "csharp" )
729- } ) ;
718+ ] ) ;
730719 }
731720
732721 [ Fact ]
@@ -758,8 +747,7 @@ public void cell_with_dotnet_metadata_but_not_language_can_be_parsed()
758747
759748 notebook . Elements
760749 . Should ( )
761- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
762- {
750+ . BeEquivalentToRespectingRuntimeTypes ( [
763751 new InteractiveDocumentElement ( "// this is not really fsharp" , "csharp" )
764752 {
765753 Metadata = new Dictionary < string , object >
@@ -770,7 +758,7 @@ public void cell_with_dotnet_metadata_but_not_language_can_be_parsed()
770758 }
771759 }
772760 }
773- } ) ;
761+ ] ) ;
774762 }
775763
776764 [ Fact ]
@@ -802,8 +790,7 @@ public void cell_with_polyglot_metadata_but_not_kernel_name_can_be_parsed()
802790
803791 notebook . Elements
804792 . Should ( )
805- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
806- {
793+ . BeEquivalentToRespectingRuntimeTypes ( [
807794 new InteractiveDocumentElement ( "// this is not really fsharp" , "csharp" )
808795 {
809796 Metadata = new Dictionary < string , object >
@@ -814,7 +801,7 @@ public void cell_with_polyglot_metadata_but_not_kernel_name_can_be_parsed()
814801 }
815802 }
816803 }
817- } ) ;
804+ ] ) ;
818805 }
819806
820807 [ Fact ]
@@ -837,10 +824,9 @@ public void code_cell_without_source_can_be_parsed()
837824 var notebook = SerializeAndParse ( jupyter ) ;
838825 notebook . Elements
839826 . Should ( )
840- . BeEquivalentToRespectingRuntimeTypes ( new [ ]
841- {
827+ . BeEquivalentToRespectingRuntimeTypes ( [
842828 new InteractiveDocumentElement ( kernelName : "csharp" )
843- } ) ;
829+ ] ) ;
844830 }
845831
846832 [ Fact ]
@@ -921,7 +907,7 @@ public void cell_display_output_without_data_member_can_be_parsed()
921907 output_type = "display_data" ,
922908 not_data = new Dictionary < string , string [ ] >
923909 {
924- { "text/html" , new [ ] { "<div>this is html</div>" } }
910+ { "text/html" , [ "<div>this is html</div>" ] }
925911 } ,
926912 execution_count = 1 ,
927913 metadata = new { }
@@ -967,7 +953,7 @@ public void execute_result_output_without_data_member_can_be_parsed()
967953 output_type = "execute_result" ,
968954 not_data = new Dictionary < string , string [ ] >
969955 {
970- { "text/html" , new [ ] { "<div>this is html</div>" } }
956+ { "text/html" , [ "<div>this is html</div>" ] }
971957 } ,
972958 execution_count = 1 ,
973959 metadata = new { }
@@ -1130,15 +1116,7 @@ public void serialized_notebook_has_appropriate_metadata()
11301116 mimetype = "text/x-csharp" ,
11311117 name = "C#" ,
11321118 pygments_lexer = "csharp" ,
1133- version = "10.0"
1134- } ,
1135- dotnet_interactive = new
1136- {
1137- defaultKernelName = "csharp" ,
1138- items = new object [ ]
1139- {
1140- new { name = "csharp" }
1141- }
1119+ version = "13.0"
11421120 } ,
11431121 polyglot_notebook = new
11441122 {
@@ -1443,7 +1421,7 @@ public void rich_cell_outputs_are_serialized()
14431421 output_type = "display_data" ,
14441422 data = new Dictionary < string , string [ ] >
14451423 {
1446- { "text/html" , new [ ] { "<div>this is html</div>" } }
1424+ { "text/html" , [ "<div>this is html</div>" ] }
14471425 } ,
14481426 metadata = new { }
14491427 }
@@ -1470,7 +1448,7 @@ public void rich_cell_outputs_are_parsed()
14701448 output_type = "display_data" ,
14711449 data = new Dictionary < string , string [ ] >
14721450 {
1473- { "text/html" , new [ ] { "<div>this is html</div>" } }
1451+ { "text/html" , [ "<div>this is html</div>" ] }
14741452 } ,
14751453 }
14761454 }
@@ -1500,11 +1478,11 @@ public void error_cell_outputs_are_serialized()
15001478 {
15011479 new ( "//" , "csharp" , new [ ]
15021480 {
1503- new ErrorElement ( "e-value" , "e-name" , new [ ] { "at func1()" , "at func2()" } )
1481+ new ErrorElement ( "e-value" , "e-name" , [ "at func1()" , "at func2()" ] )
15041482 } )
15051483 } ;
15061484 var notebook = new InteractiveDocument ( cells ) ;
1507- var serialized = ( string ) notebook . ToJupyterJson ( ) ;
1485+ var serialized = notebook . ToJupyterJson ( ) ;
15081486 var jupyter = JToken . Parse ( serialized ) ;
15091487 jupyter [ "cells" ]
15101488 . Should ( )
@@ -1569,11 +1547,10 @@ public void error_cell_outputs_are_parsed()
15691547 . ContainSingle ( )
15701548 . Which
15711549 . Should ( )
1572- . BeEquivalentToRespectingRuntimeTypes ( new ErrorElement ( "e-value" , "e-name" , new [ ]
1573- {
1550+ . BeEquivalentToRespectingRuntimeTypes ( new ErrorElement ( "e-value" , "e-name" , [
15741551 "at func1()" ,
15751552 "at func2()"
1576- } ) ) ;
1553+ ] ) ) ;
15771554 }
15781555
15791556 [ Theory ]
@@ -1652,5 +1629,5 @@ private async Task<string> RoundTripIpynb(string filePath)
16521629 private string GetNotebookFilePath ( [ CallerMemberName ] string testName = null ) =>
16531630 Path . Combine (
16541631 Path . GetDirectoryName ( PathToCurrentSourceFile ( ) ) ,
1655- $ "{ GetType ( ) . Name } .{ testName } .approved.json ") ;
1632+ $ "{ GetType ( ) . Name } .{ testName } .approved.ipynb ") ;
16561633}
0 commit comments