{"action":"created","comment":{"url":"https://api.github.com/repos/pgmpy/pgmpy/pulls/comments/56742941","id":56742941,"diff_hunk":"@@ -259,47 +395,106 @@ def test_eq(self):\n         self.assertTrue(self.phi == self.phi)\n         self.assertTrue(self.phi1 == self.phi1)\n \n+        self.assertTrue(self.phi5 == self.phi5)\n+        self.assertFalse(self.phi5 == self.phi6)\n+        self.assertTrue(self.phi6 == self.phi6)\n+\n     def test_eq1(self):\n         phi1 = Factor(['x1', 'x2', 'x3'], [2, 4, 3], range(24))\n-        phi2 = Factor(['x2', 'x1', 'x3'], [4, 2, 3], [0, 1, 2, 12, 13, 14, 3,\n-                                                      4, 5, 15, 16, 17, 6, 7,\n-                                                      8, 18, 19, 20, 9, 10, 11,\n-                                                      21, 22, 23])\n+        phi2 = Factor(['x2', 'x1', 'x3'], [4, 2, 3],\n+                      [0, 1, 2, 12, 13, 14, 3,\n+                      4, 5, 15, 16, 17, 6, 7,\n+                      8, 18, 19, 20, 9, 10, 11,\n+                      21, 22, 23])\n         self.assertTrue(phi1 == phi2)\n         self.assertEqual(phi2.variables, ['x2', 'x1', 'x3'])\n \n-    def test_hash(self):\n-        phi = Factor(['x1', 'x2'], [2, 2], [1, 2, 3, 4])\n-        phi1 = Factor(['x2', 'x1'], [2, 2], [1, 3, 2, 4])\n-        self.assertEqual(hash(phi), hash(phi1))\n-\n-        phi = Factor(['x1', 'x2', 'x3'], [2, 2, 2], range(8))\n-        phi1 = Factor(['x3', 'x1', 'x2'], [2, 2, 2], [0, 2, 4, 6, 1, 3, 5, 7])\n-        self.assertEqual(hash(phi), hash(phi1))\n+        tup1 = ('x1', 'x2')\n+        tup2 = ('x2', 'x3')\n+        tup3 = ('x3', 'x4')\n+        phi3 = Factor([tup1, tup2, tup3], [2, 4, 3], range(24))\n+        phi4 = Factor([tup2, tup1, tup3], [4, 2, 3],\n+                      [0, 1, 2, 12, 13, 14, 3,\n+                      4, 5, 15, 16, 17, 6, 7,\n+                      8, 18, 19, 20, 9, 10, 11,\n+                      21, 22, 23])\n+        self.assertTrue(phi3 == phi4)\n \n-    def test_maximize1(self):\n+    def test_hash(self):\n+        phi1 = Factor(['x1', 'x2'], [2, 2], [1, 2, 3, 4])\n+        phi2 = Factor(['x2', 'x1'], [2, 2], [1, 3, 2, 4])\n+        self.assertEqual(hash(phi1), hash(phi2))\n+\n+        phi1 = Factor(['x1', 'x2', 'x3'], [2, 2, 2], range(8))\n+        phi2 = Factor(['x3', 'x1', 'x2'], [2, 2, 2], [0, 2, 4, 6, 1, 3, 5, 7])\n+        self.assertEqual(hash(phi1), hash(phi2))\n+\n+        class TestHash:","path":"pgmpy/tests/test_factors/test_Factor.py","position":372,"original_position":372,"commit_id":"d643f706bfffd9b84d3464bd00c3950904ea80d6","original_commit_id":"d643f706bfffd9b84d3464bd00c3950904ea80d6","user":{"login":"ankurankan","id":1461453,"avatar_url":"https://avatars.githubusercontent.com/u/1461453?v=3","gravatar_id":"","url":"https://api.github.com/users/ankurankan","html_url":"https://github.com/ankurankan","followers_url":"https://api.github.com/users/ankurankan/followers","following_url":"https://api.github.com/users/ankurankan/following{/other_user}","gists_url":"https://api.github.com/users/ankurankan/gists{/gist_id}","starred_url":"https://api.github.com/users/ankurankan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ankurankan/subscriptions","organizations_url":"https://api.github.com/users/ankurankan/orgs","repos_url":"https://api.github.com/users/ankurankan/repos","events_url":"https://api.github.com/users/ankurankan/events{/privacy}","received_events_url":"https://api.github.com/users/ankurankan/received_events","type":"User","site_admin":false},"body":"@abhi95 No. Nested class or functions is not a very good idea unless necessary. So try to put this in the module level.","created_at":"2016-03-19T03:02:18Z","updated_at":"2016-03-19T03:02:18Z","html_url":"https://github.com/pgmpy/pgmpy/pull/670#discussion_r56742941","pull_request_url":"https://api.github.com/repos/pgmpy/pgmpy/pulls/670","_links":{"self":{"href":"https://api.github.com/repos/pgmpy/pgmpy/pulls/comments/56742941"},"html":{"href":"https://github.com/pgmpy/pgmpy/pull/670#discussion_r56742941"},"pull_request":{"href":"https://api.github.com/repos/pgmpy/pgmpy/pulls/670"}}},"pull_request":{"url":"https://api.github.com/repos/pgmpy/pgmpy/pulls/670","id":63216023,"html_url":"https://github.com/pgmpy/pgmpy/pull/670","diff_url":"https://github.com/pgmpy/pgmpy/pull/670.diff","patch_url":"https://github.com/pgmpy/pgmpy/pull/670.patch","issue_url":"https://api.github.com/repos/pgmpy/pgmpy/issues/670","number":670,"state":"open","locked":false,"title":"Adds tests to factors with hashable variables","user":{"login":"abhi95","id":7688397,"avatar_url":"https://avatars.githubusercontent.com/u/7688397?v=3","gravatar_id":"","url":"https://api.github.com/users/abhi95","html_url":"https://github.com/abhi95","followers_url":"https://api.github.com/users/abhi95/followers","following_url":"https://api.github.com/users/abhi95/following{/other_user}","gists_url":"https://api.github.com/users/abhi95/gists{/gist_id}","starred_url":"https://api.github.com/users/abhi95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhi95/subscriptions","organizations_url":"https://api.github.com/users/abhi95/orgs","repos_url":"https://api.github.com/users/abhi95/repos","events_url":"https://api.github.com/users/abhi95/events{/privacy}","received_events_url":"https://api.github.com/users/abhi95/received_events","type":"User","site_admin":false},"body":"@ankurankan Sorry for deleting old PR. I have added tests for hash function with custom hash objects.","created_at":"2016-03-17T12:37:57Z","updated_at":"2016-03-19T03:02:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83e4f9875f527582cbd44313b17dca6f1c7015d3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pgmpy/pgmpy/pulls/670/commits","review_comments_url":"https://api.github.com/repos/pgmpy/pgmpy/pulls/670/comments","review_comment_url":"https://api.github.com/repos/pgmpy/pgmpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pgmpy/pgmpy/issues/670/comments","statuses_url":"https://api.github.com/repos/pgmpy/pgmpy/statuses/d643f706bfffd9b84d3464bd00c3950904ea80d6","head":{"label":"abhi95:tests/factor-hashable-variables","ref":"tests/factor-hashable-variables","sha":"d643f706bfffd9b84d3464bd00c3950904ea80d6","user":{"login":"abhi95","id":7688397,"avatar_url":"https://avatars.githubusercontent.com/u/7688397?v=3","gravatar_id":"","url":"https://api.github.com/users/abhi95","html_url":"https://github.com/abhi95","followers_url":"https://api.github.com/users/abhi95/followers","following_url":"https://api.github.com/users/abhi95/following{/other_user}","gists_url":"https://api.github.com/users/abhi95/gists{/gist_id}","starred_url":"https://api.github.com/users/abhi95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhi95/subscriptions","organizations_url":"https://api.github.com/users/abhi95/orgs","repos_url":"https://api.github.com/users/abhi95/repos","events_url":"https://api.github.com/users/abhi95/events{/privacy}","received_events_url":"https://api.github.com/users/abhi95/received_events","type":"User","site_admin":false},"repo":{"id":54113752,"name":"pgmpy","full_name":"abhi95/pgmpy","owner":{"login":"abhi95","id":7688397,"avatar_url":"https://avatars.githubusercontent.com/u/7688397?v=3","gravatar_id":"","url":"https://api.github.com/users/abhi95","html_url":"https://github.com/abhi95","followers_url":"https://api.github.com/users/abhi95/followers","following_url":"https://api.github.com/users/abhi95/following{/other_user}","gists_url":"https://api.github.com/users/abhi95/gists{/gist_id}","starred_url":"https://api.github.com/users/abhi95/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abhi95/subscriptions","organizations_url":"https://api.github.com/users/abhi95/orgs","repos_url":"https://api.github.com/users/abhi95/repos","events_url":"https://api.github.com/users/abhi95/events{/privacy}","received_events_url":"https://api.github.com/users/abhi95/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abhi95/pgmpy","description":"Python Library for Probabilistic Graphical Models","fork":true,"url":"https://api.github.com/repos/abhi95/pgmpy","forks_url":"https://api.github.com/repos/abhi95/pgmpy/forks","keys_url":"https://api.github.com/repos/abhi95/pgmpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abhi95/pgmpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abhi95/pgmpy/teams","hooks_url":"https://api.github.com/repos/abhi95/pgmpy/hooks","issue_events_url":"https://api.github.com/repos/abhi95/pgmpy/issues/events{/number}","events_url":"https://api.github.com/repos/abhi95/pgmpy/events","assignees_url":"https://api.github.com/repos/abhi95/pgmpy/assignees{/user}","branches_url":"https://api.github.com/repos/abhi95/pgmpy/branches{/branch}","tags_url":"https://api.github.com/repos/abhi95/pgmpy/tags","blobs_url":"https://api.github.com/repos/abhi95/pgmpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abhi95/pgmpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abhi95/pgmpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/abhi95/pgmpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abhi95/pgmpy/statuses/{sha}","languages_url":"https://api.github.com/repos/abhi95/pgmpy/languages","stargazers_url":"https://api.github.com/repos/abhi95/pgmpy/stargazers","contributors_url":"https://api.github.com/repos/abhi95/pgmpy/contributors","subscribers_url":"https://api.github.com/repos/abhi95/pgmpy/subscribers","subscription_url":"https://api.github.com/repos/abhi95/pgmpy/subscription","commits_url":"https://api.github.com/repos/abhi95/pgmpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/abhi95/pgmpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/abhi95/pgmpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/abhi95/pgmpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/abhi95/pgmpy/contents/{+path}","compare_url":"https://api.github.com/repos/abhi95/pgmpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abhi95/pgmpy/merges","archive_url":"https://api.github.com/repos/abhi95/pgmpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abhi95/pgmpy/downloads","issues_url":"https://api.github.com/repos/abhi95/pgmpy/issues{/number}","pulls_url":"https://api.github.com/repos/abhi95/pgmpy/pulls{/number}","milestones_url":"https://api.github.com/repos/abhi95/pgmpy/milestones{/number}","notifications_url":"https://api.github.com/repos/abhi95/pgmpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abhi95/pgmpy/labels{/name}","releases_url":"https://api.github.com/repos/abhi95/pgmpy/releases{/id}","deployments_url":"https://api.github.com/repos/abhi95/pgmpy/deployments","created_at":"2016-03-17T11:46:51Z","updated_at":"2016-03-17T11:46:53Z","pushed_at":"2016-03-17T12:34:36Z","git_url":"git://github.com/abhi95/pgmpy.git","ssh_url":"git@github.com:abhi95/pgmpy.git","clone_url":"https://github.com/abhi95/pgmpy.git","svn_url":"https://github.com/abhi95/pgmpy","homepage":null,"size":4897,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"dev"}},"base":{"label":"pgmpy:dev","ref":"dev","sha":"4066f9cdf8f224ce8e1625070a2aced85d5fff20","user":{"login":"pgmpy","id":5500131,"avatar_url":"https://avatars.githubusercontent.com/u/5500131?v=3","gravatar_id":"","url":"https://api.github.com/users/pgmpy","html_url":"https://github.com/pgmpy","followers_url":"https://api.github.com/users/pgmpy/followers","following_url":"https://api.github.com/users/pgmpy/following{/other_user}","gists_url":"https://api.github.com/users/pgmpy/gists{/gist_id}","starred_url":"https://api.github.com/users/pgmpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgmpy/subscriptions","organizations_url":"https://api.github.com/users/pgmpy/orgs","repos_url":"https://api.github.com/users/pgmpy/repos","events_url":"https://api.github.com/users/pgmpy/events{/privacy}","received_events_url":"https://api.github.com/users/pgmpy/received_events","type":"Organization","site_admin":false},"repo":{"id":12968651,"name":"pgmpy","full_name":"pgmpy/pgmpy","owner":{"login":"pgmpy","id":5500131,"avatar_url":"https://avatars.githubusercontent.com/u/5500131?v=3","gravatar_id":"","url":"https://api.github.com/users/pgmpy","html_url":"https://github.com/pgmpy","followers_url":"https://api.github.com/users/pgmpy/followers","following_url":"https://api.github.com/users/pgmpy/following{/other_user}","gists_url":"https://api.github.com/users/pgmpy/gists{/gist_id}","starred_url":"https://api.github.com/users/pgmpy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgmpy/subscriptions","organizations_url":"https://api.github.com/users/pgmpy/orgs","repos_url":"https://api.github.com/users/pgmpy/repos","events_url":"https://api.github.com/users/pgmpy/events{/privacy}","received_events_url":"https://api.github.com/users/pgmpy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pgmpy/pgmpy","description":"Python Library for Probabilistic Graphical Models","fork":false,"url":"https://api.github.com/repos/pgmpy/pgmpy","forks_url":"https://api.github.com/repos/pgmpy/pgmpy/forks","keys_url":"https://api.github.com/repos/pgmpy/pgmpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pgmpy/pgmpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pgmpy/pgmpy/teams","hooks_url":"https://api.github.com/repos/pgmpy/pgmpy/hooks","issue_events_url":"https://api.github.com/repos/pgmpy/pgmpy/issues/events{/number}","events_url":"https://api.github.com/repos/pgmpy/pgmpy/events","assignees_url":"https://api.github.com/repos/pgmpy/pgmpy/assignees{/user}","branches_url":"https://api.github.com/repos/pgmpy/pgmpy/branches{/branch}","tags_url":"https://api.github.com/repos/pgmpy/pgmpy/tags","blobs_url":"https://api.github.com/repos/pgmpy/pgmpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pgmpy/pgmpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pgmpy/pgmpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/pgmpy/pgmpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pgmpy/pgmpy/statuses/{sha}","languages_url":"https://api.github.com/repos/pgmpy/pgmpy/languages","stargazers_url":"https://api.github.com/repos/pgmpy/pgmpy/stargazers","contributors_url":"https://api.github.com/repos/pgmpy/pgmpy/contributors","subscribers_url":"https://api.github.com/repos/pgmpy/pgmpy/subscribers","subscription_url":"https://api.github.com/repos/pgmpy/pgmpy/subscription","commits_url":"https://api.github.com/repos/pgmpy/pgmpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/pgmpy/pgmpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/pgmpy/pgmpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/pgmpy/pgmpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/pgmpy/pgmpy/contents/{+path}","compare_url":"https://api.github.com/repos/pgmpy/pgmpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pgmpy/pgmpy/merges","archive_url":"https://api.github.com/repos/pgmpy/pgmpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pgmpy/pgmpy/downloads","issues_url":"https://api.github.com/repos/pgmpy/pgmpy/issues{/number}","pulls_url":"https://api.github.com/repos/pgmpy/pgmpy/pulls{/number}","milestones_url":"https://api.github.com/repos/pgmpy/pgmpy/milestones{/number}","notifications_url":"https://api.github.com/repos/pgmpy/pgmpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pgmpy/pgmpy/labels{/name}","releases_url":"https://api.github.com/repos/pgmpy/pgmpy/releases{/id}","deployments_url":"https://api.github.com/repos/pgmpy/pgmpy/deployments","created_at":"2013-09-20T08:18:58Z","updated_at":"2016-03-12T08:19:33Z","pushed_at":"2016-03-18T08:38:24Z","git_url":"git://github.com/pgmpy/pgmpy.git","ssh_url":"git@github.com:pgmpy/pgmpy.git","clone_url":"https://github.com/pgmpy/pgmpy.git","svn_url":"https://github.com/pgmpy/pgmpy","homepage":null,"size":6048,"stargazers_count":198,"watchers_count":198,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":90,"mirror_url":null,"open_issues_count":77,"forks":90,"open_issues":77,"watchers":198,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/pgmpy/pgmpy/pulls/670"},"html":{"href":"https://github.com/pgmpy/pgmpy/pull/670"},"issue":{"href":"https://api.github.com/repos/pgmpy/pgmpy/issues/670"},"comments":{"href":"https://api.github.com/repos/pgmpy/pgmpy/issues/670/comments"},"review_comments":{"href":"https://api.github.com/repos/pgmpy/pgmpy/pulls/670/comments"},"review_comment":{"href":"https://api.github.com/repos/pgmpy/pgmpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pgmpy/pgmpy/pulls/670/commits"},"statuses":{"href":"https://api.github.com/repos/pgmpy/pgmpy/statuses/d643f706bfffd9b84d3464bd00c3950904ea80d6"}}}}