def test_check_without_enddate(): header_sample = """--- layout: bootcamp root: . venue: Euphoric State University address: 123 College Street, Euphoria country: United-States humandate: Feb 17-18, 2020 humantime: 9:00 am - 4:30 pm startdate: 2020-06-17 latlng: 41.7901128,-87.6007318 registration: restricted instructor: ["Grace Hopper", "Alan Turing"] contact: [email protected] ---""" assert validator.check_file(make_file(header_sample))
def test_check_file(): header_sample = """--- layout: bootcamp root: . venue: Euphoric State University address: 123 College Street, Euphoria country: United-States humandate: Feb 17-18, 2020 humantime: 9:00 am - 4:30 pm startdate: 2020-06-17 enddate: 2020-06-18 latlng: 41.7901128,-87.6007318 registration: restricted instructor: ["Grace Hopper", "Alan Turing"] contact: [email protected] ---""" try: # this happens in Python3 file_ = StringIO(header_sample) except TypeError: # this happens in Python2 file_ = StringIO(unicode(header_sample)) assert swc_index_validator.check_file(file_)