Spaces:
Running
Running
david-oplatka
commited on
Commit
•
cc9cab6
1
Parent(s):
cababc6
Update test_agent.py
Browse files- test_agent.py +8 -10
test_agent.py
CHANGED
@@ -1,6 +1,4 @@
|
|
1 |
-
|
2 |
import unittest
|
3 |
-
import re
|
4 |
import os
|
5 |
|
6 |
from omegaconf import OmegaConf
|
@@ -26,9 +24,9 @@ class TestAgentResponses(unittest.TestCase):
|
|
26 |
self.assertIsInstance(agent, Agent)
|
27 |
|
28 |
# Test whether cases are real or fake
|
29 |
-
self.
|
30 |
-
self.
|
31 |
-
self.
|
32 |
|
33 |
# Test case citation extraction
|
34 |
self.assertEqual(agent.chat('What is the citation for the case Brown v. Board of Education? Provide ONLY the citation in "<volume>, <reporter>, <page>" format, nothing else.'), '347 U.S. 483')
|
@@ -41,9 +39,9 @@ class TestAgentResponses(unittest.TestCase):
|
|
41 |
self.assertEqual(agent.chat('Who wrote the majority opinion in McCulloch v. Maryland, 17 U.S. 316 (1819)? Provide the first and the last name of the judge ONLY.'), 'John Marshall')
|
42 |
|
43 |
# Test opinion text understanding
|
44 |
-
self.
|
45 |
-
self.
|
46 |
-
self.
|
47 |
|
48 |
# Test court identification
|
49 |
self.assertIn('united states court of appeals for the second circuit', agent.chat("Which court decided the case Viacom International Inc. v. YouTube, Inc., 676 F.3d 19 (2012)? Provide the name of the court ONLY, nothing else.").lower())
|
@@ -55,9 +53,9 @@ class TestAgentResponses(unittest.TestCase):
|
|
55 |
self.assertEqual(agent.chat("What year was Austin v. Michigan Chamber of Commerce, 494 U.S. 652, overruled? Provide the year only."), '2010')
|
56 |
|
57 |
# Compare two rulings
|
58 |
-
self.
|
59 |
# self.assertEqual(agent.chat('Do the cases Youngstown Sheet & Tube Co. v. Sawyer, 343 U.S. 579 (1952) and Medellin v. Texas, 552 U.S. 491 (2008) agree or disagree with each other? Say "agree" or "disagree" only.').lower(), 'agree') # Our agent thinks that these rulings disagree, so I commented out this test.
|
60 |
-
self.
|
61 |
|
62 |
|
63 |
if __name__ == "__main__":
|
|
|
|
|
1 |
import unittest
|
|
|
2 |
import os
|
3 |
|
4 |
from omegaconf import OmegaConf
|
|
|
24 |
self.assertIsInstance(agent, Agent)
|
25 |
|
26 |
# Test whether cases are real or fake
|
27 |
+
self.assertIn('yes', agent.chat('Is the case Brown v. Board of Education, 347 U.S. 483 (1954), a real case? Say "yes" or "no" only.').lower())
|
28 |
+
self.assertIn('yes', agent.chat('Is the case Bowers v. Hardwick, 478 U.S. 186 (1986), a real case? Say "yes" or "no" only.').lower())
|
29 |
+
self.assertIn('no', agent.chat('Is the case Columbia University v. Rodham, 564 U.S. 911 (2010), a real case? Say "yes" or "no" only.').lower())
|
30 |
|
31 |
# Test case citation extraction
|
32 |
self.assertEqual(agent.chat('What is the citation for the case Brown v. Board of Education? Provide ONLY the citation in "<volume>, <reporter>, <page>" format, nothing else.'), '347 U.S. 483')
|
|
|
39 |
self.assertEqual(agent.chat('Who wrote the majority opinion in McCulloch v. Maryland, 17 U.S. 316 (1819)? Provide the first and the last name of the judge ONLY.'), 'John Marshall')
|
40 |
|
41 |
# Test opinion text understanding
|
42 |
+
self.assertIn('affirm', agent.chat("Did the court in Plessy v. Ferguson, 163 U.S. 537 (1896) affirm or reverse the lower court's decision? Say 'affirm' or 'reverse' only.").lower())
|
43 |
+
self.assertIn('reverse', agent.chat("Did the court in Bowers v. Hardwick, 478 U.S. 186 (1986) affirm or reverse the lower court's decision? Say 'affirm' or 'reverse' only.").lower())
|
44 |
+
self.assertIn('reverse', agent.chat("Did the court in McCulloch v. Maryland, 17 U.S. 316 (1819) affirm or reverse the lower court's decision? Say 'affirm' or 'reverse' only.").lower())
|
45 |
|
46 |
# Test court identification
|
47 |
self.assertIn('united states court of appeals for the second circuit', agent.chat("Which court decided the case Viacom International Inc. v. YouTube, Inc., 676 F.3d 19 (2012)? Provide the name of the court ONLY, nothing else.").lower())
|
|
|
53 |
self.assertEqual(agent.chat("What year was Austin v. Michigan Chamber of Commerce, 494 U.S. 652, overruled? Provide the year only."), '2010')
|
54 |
|
55 |
# Compare two rulings
|
56 |
+
self.assertIn('disagree', agent.chat('Do the cases Brown v. Board of Education, 347 U.S. 483 (1954) and Plessy v. Ferguson, 163 U.S. 537 (1896) agree or disagree with each other? Say "agree" or "disagree" only.').lower())
|
57 |
# self.assertEqual(agent.chat('Do the cases Youngstown Sheet & Tube Co. v. Sawyer, 343 U.S. 579 (1952) and Medellin v. Texas, 552 U.S. 491 (2008) agree or disagree with each other? Say "agree" or "disagree" only.').lower(), 'agree') # Our agent thinks that these rulings disagree, so I commented out this test.
|
58 |
+
self.assertIn('disagree', agent.chat('Do the cases Whitney v. California, 274 U.S. 357 (1927) and Brandenburg v. Ohio, 395 U.S. 444 (1969) agree or disagree with each other? Say "agree" or "disagree" only.').lower())
|
59 |
|
60 |
|
61 |
if __name__ == "__main__":
|