def test_Create_UnDefinedFacet_Tree1(self): facet = '?????' tree = 'tree1' with self.assertRaises(Exception) as e: subtype = SubTypeTreeFactory.Create(facet, tree.split('.')) self.assertEqual( e.msg, '未定義のファセットです。ファセットは {facets} のうちのどれかにしてください。入力値: {facet}'. format('vnd,prs,x', facet))
def test_ParsonalTree(self): facet = 'prs' tree_list_string = 'tree1.tree2' sub_type_string = '{facet}.{tree_list_string}'.format( facet=facet, tree_list_string=tree_list_string) split = sub_type_string.split('.') subtype = SubTypeTreeFactory.Create(split[0], split[1:]) self.assertTrue(isinstance(subtype, ParsonalTree)) self.assertEqual('prs', ParsonalTree.GetFacet()) """
def test_GitHubVenderTree3(self): facet = 'vnd' vender_name = 'github' sub_type_string = "{facet}.{vender_name}".format( facet=facet, vender_name=vender_name) subtype = SubTypeTreeFactory.Create(facet, sub_type_string.split('.')[1:]) self.assertTrue( isinstance(subtype, (SubTypeTree, VenderTree, GitHubVenderTree))) self.assertEqual(facet, GitHubVenderTree.GetFacet()) self.assertEqual(vender_name, subtype.VenderName) self.assertEqual(None, subtype.Version) self.assertEqual(None, subtype.Parameter)
def test_GitHubVenderTree1(self): facet = 'vnd' vender_name = 'github' version = 'v3' sub_type_string = "{facet}.{vender_name}.{version}".format( facet=facet, vender_name=vender_name, version=version) # subtype = SubTypeTreeFactory.Create(facet, sub_type_string.split('.')[1:-1]) subtype = SubTypeTreeFactory.Create(facet, sub_type_string.split('.')[1:]) self.assertTrue( isinstance(subtype, (SubTypeTree, VenderTree, GitHubVenderTree))) self.assertEqual(facet, GitHubVenderTree.GetFacet()) # print("TreeList={0}".format(subtype.TreeList)) self.assertEqual(vender_name, subtype.VenderName) self.assertEqual(facet, subtype.GetFacet()) self.assertTrue( isinstance(subtype, (SubTypeTree, VenderTree, GitHubVenderTree))) # print(subtype.mro()) # self.assertTrue(hasattr('Version', subtype)) self.assertEqual(version, subtype.Version) self.assertEqual(None, subtype.Parameter) self.assertEqual(vender_name, subtype.VenderName) self.assertEqual(facet, subtype.GetFacet())
def test_Create_GitHubVenderTree(self): facet = 'vnd' tree = 'github' subtype = SubTypeTreeFactory.Create(facet, tree.split('.')) self.assertTrue(isinstance(subtype, GitHubVenderTree))
def test_Create_UnRegisteredVenderTree(self): facet = 'vnd' tree = '?????' subtype = SubTypeTreeFactory.Create(facet, tree.split('.')) self.assertTrue(isinstance(subtype, VenderTree))
def test_StandardTree4(self): subtype = SubTypeTreeFactory.Create("", []) self.assertTrue(isinstance(subtype, StandardTree)) self.assertEqual(None, StandardTree.GetFacet())
def test_StandardTree2(self): facet = 'json' subtype = SubTypeTreeFactory.Create(facet, []) self.assertTrue(isinstance(subtype, StandardTree)) self.assertEqual(None, StandardTree.GetFacet())
def test_Create_ParsonalTree_TreeBlank(self): facet = 'prs' tree = '....' subtype = SubTypeTreeFactory.Create(facet, tree.split('.')) self.assertTrue(isinstance(subtype, ParsonalTree))
def test_Create_UnregisteredTree_TreeBlank(self): facet = 'x' tree = '....' subtype = SubTypeTreeFactory.Create(facet, tree.split('.')) self.assertTrue(isinstance(subtype, UnregisteredTree))
def test_Create_StandardTree_FacetBlank_TreeBlankString(self): subtype = SubTypeTreeFactory.Create('', ['']) self.assertTrue(isinstance(subtype, StandardTree))
def test_Create_StandardTree_FacetNone_TreeBlankString(self): media_type = 'html' subtype = SubTypeTreeFactory.Create(None, ['']) self.assertTrue(isinstance(subtype, StandardTree))
def test_Create_VenderTree_TreeBlank(self): facet = 'vnd' tree = '....' subtype = SubTypeTreeFactory.Create(facet, tree.split('.')) self.assertTrue(isinstance(subtype, VenderTree))