示例#1
0
 def test_athlete_valid_against_schema(self):
     self.assertTrue(
         valid_against_schema("sample-jsons/athlete.json",
                              "json/athlete.json"))
     self.assertTrue(
         valid_against_schema("sample-jsons/athlete_minimal.json",
                              "json/athlete.json"))
示例#2
0
 def test_performance_valid_against_schema(self):
     self.assertTrue(
         valid_against_schema("sample-jsons/performance.json",
                              "json/performance.json"))
     self.assertTrue(
         valid_against_schema("sample-jsons/performance_minimal.json",
                              "json/performance.json"))
示例#3
0
    def test_invalid_against_metaschema(self):
        with self.assertRaises(ValidationError):
            valid_against_schema("sample-jsons/athlete_invalid.json",
                                 "json/metaschema.json",
                                 expect_failure=True)

        with self.assertRaises(ValidationError):
            valid_against_schema(
                "sample-jsons/combined_performance_invalid.json",
                "json/metaschema.json",
                expect_failure=True)

        with self.assertRaises(ValidationError):
            valid_against_schema("sample-jsons/competition_invalid.json",
                                 "json/metaschema.json",
                                 expect_failure=True)

        with self.assertRaises(ValidationError):
            valid_against_schema("sample-jsons/event_invalid.json",
                                 "json/metaschema.json",
                                 expect_failure=True)

        with self.assertRaises(ValidationError):
            valid_against_schema("sample-jsons/performance_invalid.json",
                                 "json/metaschema.json",
                                 expect_failure=True)
示例#4
0
 def test_competition_valid_against_schema(self):
     self.assertTrue(
         valid_against_schema("sample-jsons/competition.json",
                              "json/competition.json"))
     self.assertTrue(
         valid_against_schema("sample-jsons/competition_minimal.json",
                              "json/competition.json"))
示例#5
0
    def test_performance_invalid_against_schema(self):
        with self.assertRaises(ValidationError):
            valid_against_schema("sample-jsons/performance_invalid.json",
                                 "json/performance.json",
                                 expect_failure=True)

        with self.assertRaises(ValidationError):
            valid_against_schema("sample-jsons/performance_invalid2.json",
                                 "json/performance.json",
                                 expect_failure=True)
示例#6
0
 def test_valid_against_metaschema(self):
     self.assertTrue(
         valid_against_schema("sample-jsons/athlete.json",
                              "json/metaschema.json"))
     self.assertTrue(
         valid_against_schema("sample-jsons/combined_performance.json",
                              "json/metaschema.json"))
     self.assertTrue(
         valid_against_schema("sample-jsons/competition.json",
                              "json/metaschema.json"))
     self.assertTrue(
         valid_against_schema("sample-jsons/event.json",
                              "json/metaschema.json"))
     self.assertTrue(
         valid_against_schema("sample-jsons/performance.json",
                              "json/metaschema.json"))
示例#7
0
 def test_race_valid_against_schema(self):
     self.assertTrue(
         valid_against_schema(
             "sample-jsons/race_iffleymiles_2016_600mA.json",
             "json/race.json"))
     self.assertTrue(
         valid_against_schema(
             "sample-jsons/race_iffleymiles_2016_600mB.json",
             "json/race.json"))
     self.assertTrue(
         valid_against_schema(
             "sample-jsons/race_iffleymiles_2016_mileA.json",
             "json/race.json"))
     self.assertTrue(
         valid_against_schema(
             "sample-jsons/race_iffleymiles_2016_mileB.json",
             "json/race.json"))
示例#8
0
    def test_race_invalid_against_schema(self):
        with self.assertRaises(ValidationError):
            valid_against_schema(
                "sample-jsons/race_invalid_athlete_internal.json",
                "json/race.json",
                expect_failure=True)

        with self.assertRaises(ValidationError):
            valid_against_schema(
                "sample-jsons/race_invalid_athlete_external.json",
                "json/race.json",
                expect_failure=True)

        with self.assertRaises(ValidationError):
            valid_against_schema("sample-jsons/race_invalid_position.json",
                                 "json/race.json",
                                 expect_failure=True)

        with self.assertRaises(ValidationError):
            valid_against_schema("sample-jsons/race_invalid_result.json",
                                 "json/race.json",
                                 expect_failure=True)
示例#9
0
 def test_athlete_invalid_against_schema(self):
     with self.assertRaises(ValidationError):
         valid_against_schema("sample-jsons/athlete_invalid.json",
                              "json/athlete.json",
                              expect_failure=True)
示例#10
0
 def test_event_valid_against_schema(self):
     self.assertTrue(
         valid_against_schema("sample-jsons/event.json", "json/event.json"))
     self.assertTrue(
         valid_against_schema("sample-jsons/event_minimal.json",
                              "json/event.json"))
示例#11
0
 def test_competition_invalid_against_schema(self):
     with self.assertRaises(ValidationError):
         valid_against_schema("sample-jsons/competition_invalid.json",
                              "json/competition.json",
                              expect_failure=True)