You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/FSharp.Data.Tests/CsvProvider.fs
+33Lines changed: 33 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -639,3 +639,36 @@ let ``InferColumnTypes shall infer empty string as Double``() =
639
639
letexpected="Double"
640
640
letactual= types.[3].Value.InferedType.Name
641
641
actual |> should equal expected
642
+
643
+
let [<Literal>]manyColumnCsv="""
644
+
"001","2022-01-01 10:00:00","100.00","John S.","+1 (555) 123-4567","john@example.com","","John Smith","California","Los Angeles","123 Main St.","90001","P001","Widget A","2","25.00"
645
+
"002","2022-01-02 14:30:00","50.00","Alice T.","+1 (555) 987-6543","alice@example.com","Please deliver after 6pm.","Alice Thompson","New York","Brooklyn","456 Elm St.","10001","P002","Widget B","1","50.00"
646
+
"003","2022-01-03 08:15:00","75.00","Bob R.","+1 (555) 555-1212","bob@example.com","","Bob Robertson","Florida","Miami","789 Oak Ave.","33010","P003","Widget C","3","25.00"
647
+
"004","2022-01-04 16:00:00","200.00","Jane D.","+1 (555) 555-5555","jane@example.com","Please include gift receipt.","Jane Doe","Texas","Austin","321 Pine St.","78701","P004","Widget D","4","50.00"
648
+
"005","2022-01-05 12:00:00","60.00","Sam G.","+1 (555) 555-1212","sam@example.com","","Sam Green","California","San Francisco","987 Oak St.","94101","P005","Widget E","2","30.00"
649
+
"""
650
+
651
+
[<Test>]
652
+
let``Can infer from a multiline schema`` ()=
653
+
letcsv=
654
+
CsvProvider<manyColumnCsv,
655
+
HasHeaders =false,
656
+
Schema ="OrderNumber (string),
657
+
OrderCreated (string),
658
+
OrderTotal (string),
659
+
FioShort (string),
660
+
PhoneNumber (string),
661
+
Email (string),
662
+
Comment (string),
663
+
FioFull (string),
664
+
Region (string),
665
+
Town (string),
666
+
Address (string),
667
+
Postindex (string),
668
+
ProductId (string),
669
+
ProductTitle (string),
670
+
ProductQuantity (string),
671
+
ProductPrice (string)">.GetSample ()
672
+
letfirstRow= csv.Rows |> Seq.head
673
+
firstRow.OrderCreated |> should equal "2022-01-01 10:00:00"
0 commit comments