@@ -427,3 +427,78 @@ def test_semantic_location_history_2024(tmp_path_f: Path) -> None:
427427 ),
428428 ],
429429 )
430+
431+
432+ def test_keep (tmp_path_f : Path ) -> None :
433+ data = {
434+ "title" : "Grocery List" ,
435+ "userEditedTimestampUsec" : 1649291142757000 ,
436+ "createdTimestampUsec" : 1649291142757000 ,
437+ "listContent" : [
438+ {
439+ "textHtml" : "<li>Apples</li>" ,
440+ "text" : "Apples" ,
441+ "isChecked" : False
442+ },
443+ {
444+ "textHtml" : "<li>Milk</li>" ,
445+ "text" : "Milk" ,
446+ "isChecked" : True
447+ }
448+ ],
449+ "textContent" : "Don't forget to buy snacks too." ,
450+ "textContentHtml" : "<p>Don't forget to buy snacks too.</p>" ,
451+ "color" : "yellow" ,
452+ "annotations" : [
453+ {
454+ "description" : "Weekly grocery run" ,
455+ "source" : "Keep" ,
456+ "title" : "Shopping Note" ,
457+ "url" : "https://keep.google.com/"
458+ }
459+ ],
460+ "isTrashed" : False ,
461+ "isPinned" : True ,
462+ "isArchived" : False
463+ }
464+
465+ fp = tmp_path_f / "file"
466+ fp .write_text (json .dumps (data ))
467+ res = list (prj ._parse_keep (fp ))
468+ obj = res [0 ]
469+ assert not isinstance (obj , Exception )
470+ assert obj == models .Keep (
471+ title = "Grocery List" ,
472+ updated_dt = datetime .datetime (
473+ 2022 , 4 , 7 , 0 , 25 , 42 , 757000 , tzinfo = datetime .timezone .utc ,
474+ ),
475+ created_dt = datetime .datetime (
476+ 2022 , 4 , 7 , 0 , 25 , 42 , 757000 , tzinfo = datetime .timezone .utc ,
477+ ),
478+ listContent = [
479+ models .KeepListContent (
480+ textHtml = "<li>Apples</li>" ,
481+ text = "Apples" ,
482+ isChecked = False
483+ ),
484+ models .KeepListContent (
485+ textHtml = "<li>Milk</li>" ,
486+ text = "Milk" ,
487+ isChecked = True
488+ )
489+ ],
490+ textContent = "Don't forget to buy snacks too." ,
491+ textContentHtml = "<p>Don't forget to buy snacks too.</p>" ,
492+ color = "yellow" ,
493+ annotations = [
494+ models .KeepAnnotation (
495+ description = "Weekly grocery run" ,
496+ source = "Keep" ,
497+ title = "Shopping Note" ,
498+ url = "https://keep.google.com/"
499+ )
500+ ],
501+ isTrashed = False ,
502+ isPinned = True ,
503+ isArchived = False
504+ )
0 commit comments