Exemplo n.º 1
0
    def test_parse_tab_ref(self):
        #when
        actual_table_ref = TableReference.parse_tab_ref(
            "proj321:dataset123.tableabc")

        #then
        self.assertEqual(TableReference("proj321", "dataset123", "tableabc"),
                         actual_table_ref)
Exemplo n.º 2
0
    def test_parse_tab_ref_for_partitioned_table(self):
        #when
        actual_table_ref = TableReference.parse_tab_ref(
            "proj321:dataset123.tableabc$20180226")

        #then
        self.assertEqual(
            TableReference("proj321", "dataset123", "tableabc", "20180226"),
            actual_table_ref)
Exemplo n.º 3
0
 def test_parse_tab_ref_raise_exception_if_doesnt_match_naming_convention(
         self):
     with self.assertRaises(Exception):
         TableReference.parse_tab_ref("proj321dataset123.tableabc")
     with self.assertRaises(Exception):
         TableReference.parse_tab_ref("proj321dataset123tableabc")
     with self.assertRaises(Exception):
         TableReference.parse_tab_ref("proj321:dataset123.tableabc$dsfsf")
     with self.assertRaises(Exception):
         TableReference.parse_tab_ref("proj321dataset123tableabc$20180501")
     with self.assertRaises(Exception):
         TableReference.parse_tab_ref(
             "proj321:dataset123.table-abc$20180501")
     with self.assertRaises(Exception):
         TableReference.parse_tab_ref(
             "proj321:datase-t123.tableabc$20180501")
     with self.assertRaises(Exception):
         TableReference.parse_tab_ref(
             "proj_321:dataset123.tableabc$20180501")
Exemplo n.º 4
0
 def test_parse_tab_ref_do_not_raise_exception_if_it_matches_naming_convention(
         self):
     TableReference.parse_tab_ref("proj321:dataset123.tableabc$20180226")
     TableReference.parse_tab_ref("proj321:dataset123.tableabc")
     TableReference.parse_tab_ref("proj321:dataset123.tableabc_123")
     TableReference.parse_tab_ref("proj321:datas_et123.tableabc123")
     TableReference.parse_tab_ref("proj-321:dataset123.tableabc123")
     TableReference.parse_tab_ref(
         "dev-project-bbq:smoke_test_EU.epd_none_direct___cpd_indirect___rm_manual___sharded_20170804"
     )