ml_pid_cbm.tools.test_load_data

  1import unittest
  2from unittest.mock import mock_open, patch
  3from pathlib import Path
  4
  5import pandas as pd
  6from hipe4ml.tree_handler import TreeHandler
  7
  8from .load_data import LoadData
  9
 10
 11class TestLoadData(unittest.TestCase):
 12    def setUp(self):
 13        self.loader_pos = LoadData(
 14            data_file_name="data.tree",
 15            json_file_name="config.json",
 16            lower_p_cut=0.0,
 17            upper_p_cut=3.0,
 18            anti_particles=False,
 19        )
 20        self.loader_anti = LoadData(
 21            data_file_name="data.tree",
 22            json_file_name="config.json",
 23            lower_p_cut=0.0,
 24            upper_p_cut=3.0,
 25            anti_particles=True,
 26        )
 27        self.loader_empty = LoadData(
 28            data_file_name=None,
 29            json_file_name=None,
 30            lower_p_cut=0.0,
 31            upper_p_cut=3.0,
 32            anti_particles=True,
 33        )
 34        test_dir = Path(__file__).resolve().parent
 35        self.plain_tree = f"{test_dir}/test_plain_tree.root"
 36
 37    def test_clean_tree(self):
 38        # manually created entries to test data cleanin
 39        # mock json file for testing
 40        json_data = """{"var_names":{"momentum": "Complex_p","charge": "Complex_q"},
 41        "cuts":{"Complex_pT": {"lower": 0,"upper": 2.0},"Complex_eta": {"lower": 0.0,"upper": 6.0}}}"""
 42        with patch("builtins.open", mock_open(read_data=json_data)):
 43            # only positive particles
 44            test_str_pos = self.loader_pos.clean_tree()
 45            expected_str_pos = "(0.0 <= Complex_pT < 2.0) and (0.0 <= Complex_eta < 6.0) and (0.0 <= Complex_p < 3.0) and (Complex_q > 0)"
 46            test_str_neg = self.loader_anti.clean_tree()
 47            expected_str_neg = "(0.0 <= Complex_pT < 2.0) and (0.0 <= Complex_eta < 6.0) and (0.0 <= Complex_p < 3.0) and (Complex_q < 0)"
 48            self.assertEqual(test_str_pos, expected_str_pos)
 49            self.assertEqual(test_str_neg, expected_str_neg)
 50
 51    def test_get_particles_type(self):
 52        proton_entry = {
 53            "Complex_q": 1,
 54            "Complex_p": 1,
 55            "Complex_pid": 2212,
 56            "Complex_mass2": 0.8,
 57        }
 58        proton_entry_specific_p = {
 59            "Complex_q": 1,
 60            "Complex_p": 2,
 61            "Complex_pid": 2212,
 62            "Complex_mass2": 0.79,
 63        }
 64        proton_entry_outside_1sigma = {
 65            "Complex_q": 1,
 66            "Complex_p": 1,
 67            "Complex_pid": 2212,
 68            "Complex_mass2": 3.8,
 69        }
 70        pion_entry = {
 71            "Complex_q": 1,
 72            "Complex_p": 1.2,
 73            "Complex_pid": 211,
 74            "Complex_mass2": 0.2,
 75        }
 76        complete_data = [
 77            proton_entry,
 78            proton_entry,
 79            proton_entry,
 80            proton_entry,
 81            proton_entry,
 82            proton_entry_specific_p,
 83            proton_entry_outside_1sigma,
 84            pion_entry,
 85        ]
 86        # mock json file for testing
 87        json_data = """{"var_names":{"momentum": "Complex_p","charge": "Complex_q", "mass2": "Complex_mass2", "pid": "Complex_pid"}}"""
 88        tree_handler = TreeHandler()
 89        tree_handler.set_data_frame(pd.DataFrame(complete_data))
 90        with patch("builtins.open", mock_open(read_data=json_data)):
 91            protons = self.loader_pos.get_particles_type(
 92                tree_handler, 2212, 1
 93            ).get_data_frame()
 94            # should find proton inside 1sigma region
 95            self.assertEqual(
 96                protons[
 97                    protons["Complex_mass2"] == proton_entry_specific_p["Complex_mass2"]
 98                ]["Complex_p"].iloc[0],
 99                proton_entry_specific_p["Complex_p"],
100            )
101            # should filter out proton outside 1sigma region
102            pd.testing.assert_frame_equal(
103                protons[
104                    protons["Complex_mass2"]
105                    == proton_entry_outside_1sigma["Complex_mass2"]
106                ],
107                protons.drop(protons.index),
108            )
109            # should filter out pions
110            pd.testing.assert_frame_equal(
111                protons[protons["Complex_mass2"] == pion_entry["Complex_mass2"]],
112                protons.drop(protons.index),
113            )
114
115    def test_get_protons_kaons_pions(self):
116        proton_entry = {
117            "Complex_q": 1.0,
118            "Complex_p": 1.0,
119            "Complex_pid": 2212.0,
120            "Complex_mass2": 0.8,
121        }
122        kaon_entry = {
123            "Complex_q": 1.0,
124            "Complex_p": 1.2,
125            "Complex_pid": 321.0,
126            "Complex_mass2": 0.4,
127        }
128        pion_entry = {
129            "Complex_q": 1.0,
130            "Complex_p": 1.2,
131            "Complex_pid": 211.0,
132            "Complex_mass2": 0.2,
133        }
134        anti_proton_entry = {
135            "Complex_q": -1.0,
136            "Complex_p": 1.0,
137            "Complex_pid": -2212.0,
138            "Complex_mass2": 0.8,
139        }
140        anti_kaon_entry = {
141            "Complex_q": -1.0,
142            "Complex_p": 1.2,
143            "Complex_pid": -321.0,
144            "Complex_mass2": 0.4,
145        }
146        anti_pion_entry = {
147            "Complex_q": -1.0,
148            "Complex_p": 1.2,
149            "Complex_pid": -211.0,
150            "Complex_mass2": 0.2,
151        }
152        complete_data = [
153            proton_entry,
154            kaon_entry,
155            pion_entry,
156            anti_proton_entry,
157            anti_kaon_entry,
158            anti_pion_entry,
159        ]
160        # mock json file for testing
161        json_data = """{"var_names":{"momentum": "Complex_p", "charge": "Complex_q", "mass2": "Complex_mass2", "pid": "Complex_pid"}}"""
162        tree_handler = TreeHandler()
163        tree_handler.set_data_frame(pd.DataFrame(complete_data))
164        with patch("builtins.open", mock_open(read_data=json_data)):
165            protons, kaons, pions = self.loader_pos.get_protons_kaons_pions(
166                tree_handler
167            )
168            # check if each particle type was loaded correctly
169            pd.testing.assert_frame_equal(
170                protons.get_data_frame().reset_index(drop=True),
171                pd.DataFrame([proton_entry]).reset_index(drop=True),
172            )
173            pd.testing.assert_frame_equal(
174                kaons.get_data_frame().reset_index(drop=True),
175                pd.DataFrame([kaon_entry]).reset_index(drop=True),
176            )
177            pd.testing.assert_frame_equal(
178                pions.get_data_frame().reset_index(drop=True),
179                pd.DataFrame([pion_entry]).reset_index(drop=True),
180            )
181            # repeat for antiparticles
182            (
183                anti_protons,
184                anti_kaons,
185                anti_pions,
186            ) = self.loader_anti.get_protons_kaons_pions(tree_handler)
187            # check if each particle type was loaded correctly
188            pd.testing.assert_frame_equal(
189                anti_protons.get_data_frame().reset_index(drop=True),
190                pd.DataFrame([anti_proton_entry]).reset_index(drop=True),
191            )
192            pd.testing.assert_frame_equal(
193                anti_kaons.get_data_frame().reset_index(drop=True),
194                pd.DataFrame([anti_kaon_entry]).reset_index(drop=True),
195            )
196            pd.testing.assert_frame_equal(
197                anti_pions.get_data_frame().reset_index(drop=True),
198                pd.DataFrame([anti_pion_entry]).reset_index(drop=True),
199            )
200
201    def test_load_tree(self):
202        with patch.object(LoadData, "clean_tree", return_value=''):
203            self.loader_pos.load_tree(self.plain_tree)
class TestLoadData(unittest.case.TestCase):
 12class TestLoadData(unittest.TestCase):
 13    def setUp(self):
 14        self.loader_pos = LoadData(
 15            data_file_name="data.tree",
 16            json_file_name="config.json",
 17            lower_p_cut=0.0,
 18            upper_p_cut=3.0,
 19            anti_particles=False,
 20        )
 21        self.loader_anti = LoadData(
 22            data_file_name="data.tree",
 23            json_file_name="config.json",
 24            lower_p_cut=0.0,
 25            upper_p_cut=3.0,
 26            anti_particles=True,
 27        )
 28        self.loader_empty = LoadData(
 29            data_file_name=None,
 30            json_file_name=None,
 31            lower_p_cut=0.0,
 32            upper_p_cut=3.0,
 33            anti_particles=True,
 34        )
 35        test_dir = Path(__file__).resolve().parent
 36        self.plain_tree = f"{test_dir}/test_plain_tree.root"
 37
 38    def test_clean_tree(self):
 39        # manually created entries to test data cleanin
 40        # mock json file for testing
 41        json_data = """{"var_names":{"momentum": "Complex_p","charge": "Complex_q"},
 42        "cuts":{"Complex_pT": {"lower": 0,"upper": 2.0},"Complex_eta": {"lower": 0.0,"upper": 6.0}}}"""
 43        with patch("builtins.open", mock_open(read_data=json_data)):
 44            # only positive particles
 45            test_str_pos = self.loader_pos.clean_tree()
 46            expected_str_pos = "(0.0 <= Complex_pT < 2.0) and (0.0 <= Complex_eta < 6.0) and (0.0 <= Complex_p < 3.0) and (Complex_q > 0)"
 47            test_str_neg = self.loader_anti.clean_tree()
 48            expected_str_neg = "(0.0 <= Complex_pT < 2.0) and (0.0 <= Complex_eta < 6.0) and (0.0 <= Complex_p < 3.0) and (Complex_q < 0)"
 49            self.assertEqual(test_str_pos, expected_str_pos)
 50            self.assertEqual(test_str_neg, expected_str_neg)
 51
 52    def test_get_particles_type(self):
 53        proton_entry = {
 54            "Complex_q": 1,
 55            "Complex_p": 1,
 56            "Complex_pid": 2212,
 57            "Complex_mass2": 0.8,
 58        }
 59        proton_entry_specific_p = {
 60            "Complex_q": 1,
 61            "Complex_p": 2,
 62            "Complex_pid": 2212,
 63            "Complex_mass2": 0.79,
 64        }
 65        proton_entry_outside_1sigma = {
 66            "Complex_q": 1,
 67            "Complex_p": 1,
 68            "Complex_pid": 2212,
 69            "Complex_mass2": 3.8,
 70        }
 71        pion_entry = {
 72            "Complex_q": 1,
 73            "Complex_p": 1.2,
 74            "Complex_pid": 211,
 75            "Complex_mass2": 0.2,
 76        }
 77        complete_data = [
 78            proton_entry,
 79            proton_entry,
 80            proton_entry,
 81            proton_entry,
 82            proton_entry,
 83            proton_entry_specific_p,
 84            proton_entry_outside_1sigma,
 85            pion_entry,
 86        ]
 87        # mock json file for testing
 88        json_data = """{"var_names":{"momentum": "Complex_p","charge": "Complex_q", "mass2": "Complex_mass2", "pid": "Complex_pid"}}"""
 89        tree_handler = TreeHandler()
 90        tree_handler.set_data_frame(pd.DataFrame(complete_data))
 91        with patch("builtins.open", mock_open(read_data=json_data)):
 92            protons = self.loader_pos.get_particles_type(
 93                tree_handler, 2212, 1
 94            ).get_data_frame()
 95            # should find proton inside 1sigma region
 96            self.assertEqual(
 97                protons[
 98                    protons["Complex_mass2"] == proton_entry_specific_p["Complex_mass2"]
 99                ]["Complex_p"].iloc[0],
100                proton_entry_specific_p["Complex_p"],
101            )
102            # should filter out proton outside 1sigma region
103            pd.testing.assert_frame_equal(
104                protons[
105                    protons["Complex_mass2"]
106                    == proton_entry_outside_1sigma["Complex_mass2"]
107                ],
108                protons.drop(protons.index),
109            )
110            # should filter out pions
111            pd.testing.assert_frame_equal(
112                protons[protons["Complex_mass2"] == pion_entry["Complex_mass2"]],
113                protons.drop(protons.index),
114            )
115
116    def test_get_protons_kaons_pions(self):
117        proton_entry = {
118            "Complex_q": 1.0,
119            "Complex_p": 1.0,
120            "Complex_pid": 2212.0,
121            "Complex_mass2": 0.8,
122        }
123        kaon_entry = {
124            "Complex_q": 1.0,
125            "Complex_p": 1.2,
126            "Complex_pid": 321.0,
127            "Complex_mass2": 0.4,
128        }
129        pion_entry = {
130            "Complex_q": 1.0,
131            "Complex_p": 1.2,
132            "Complex_pid": 211.0,
133            "Complex_mass2": 0.2,
134        }
135        anti_proton_entry = {
136            "Complex_q": -1.0,
137            "Complex_p": 1.0,
138            "Complex_pid": -2212.0,
139            "Complex_mass2": 0.8,
140        }
141        anti_kaon_entry = {
142            "Complex_q": -1.0,
143            "Complex_p": 1.2,
144            "Complex_pid": -321.0,
145            "Complex_mass2": 0.4,
146        }
147        anti_pion_entry = {
148            "Complex_q": -1.0,
149            "Complex_p": 1.2,
150            "Complex_pid": -211.0,
151            "Complex_mass2": 0.2,
152        }
153        complete_data = [
154            proton_entry,
155            kaon_entry,
156            pion_entry,
157            anti_proton_entry,
158            anti_kaon_entry,
159            anti_pion_entry,
160        ]
161        # mock json file for testing
162        json_data = """{"var_names":{"momentum": "Complex_p", "charge": "Complex_q", "mass2": "Complex_mass2", "pid": "Complex_pid"}}"""
163        tree_handler = TreeHandler()
164        tree_handler.set_data_frame(pd.DataFrame(complete_data))
165        with patch("builtins.open", mock_open(read_data=json_data)):
166            protons, kaons, pions = self.loader_pos.get_protons_kaons_pions(
167                tree_handler
168            )
169            # check if each particle type was loaded correctly
170            pd.testing.assert_frame_equal(
171                protons.get_data_frame().reset_index(drop=True),
172                pd.DataFrame([proton_entry]).reset_index(drop=True),
173            )
174            pd.testing.assert_frame_equal(
175                kaons.get_data_frame().reset_index(drop=True),
176                pd.DataFrame([kaon_entry]).reset_index(drop=True),
177            )
178            pd.testing.assert_frame_equal(
179                pions.get_data_frame().reset_index(drop=True),
180                pd.DataFrame([pion_entry]).reset_index(drop=True),
181            )
182            # repeat for antiparticles
183            (
184                anti_protons,
185                anti_kaons,
186                anti_pions,
187            ) = self.loader_anti.get_protons_kaons_pions(tree_handler)
188            # check if each particle type was loaded correctly
189            pd.testing.assert_frame_equal(
190                anti_protons.get_data_frame().reset_index(drop=True),
191                pd.DataFrame([anti_proton_entry]).reset_index(drop=True),
192            )
193            pd.testing.assert_frame_equal(
194                anti_kaons.get_data_frame().reset_index(drop=True),
195                pd.DataFrame([anti_kaon_entry]).reset_index(drop=True),
196            )
197            pd.testing.assert_frame_equal(
198                anti_pions.get_data_frame().reset_index(drop=True),
199                pd.DataFrame([anti_pion_entry]).reset_index(drop=True),
200            )
201
202    def test_load_tree(self):
203        with patch.object(LoadData, "clean_tree", return_value=''):
204            self.loader_pos.load_tree(self.plain_tree)

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named 'runTest'.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes:

  • failureException: determines which exception will be raised when the instance's assertion methods fail; test methods raising this exception will be deemed to have 'failed' rather than 'errored'.
  • longMessage: determines whether long messages (including repr of objects used in assert methods) will be printed on failure in addition to any explicit message passed.
  • maxDiff: sets the maximum length of a diff in failure messages by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.
def setUp(self):
13    def setUp(self):
14        self.loader_pos = LoadData(
15            data_file_name="data.tree",
16            json_file_name="config.json",
17            lower_p_cut=0.0,
18            upper_p_cut=3.0,
19            anti_particles=False,
20        )
21        self.loader_anti = LoadData(
22            data_file_name="data.tree",
23            json_file_name="config.json",
24            lower_p_cut=0.0,
25            upper_p_cut=3.0,
26            anti_particles=True,
27        )
28        self.loader_empty = LoadData(
29            data_file_name=None,
30            json_file_name=None,
31            lower_p_cut=0.0,
32            upper_p_cut=3.0,
33            anti_particles=True,
34        )
35        test_dir = Path(__file__).resolve().parent
36        self.plain_tree = f"{test_dir}/test_plain_tree.root"

Hook method for setting up the test fixture before exercising it.

def test_clean_tree(self):
38    def test_clean_tree(self):
39        # manually created entries to test data cleanin
40        # mock json file for testing
41        json_data = """{"var_names":{"momentum": "Complex_p","charge": "Complex_q"},
42        "cuts":{"Complex_pT": {"lower": 0,"upper": 2.0},"Complex_eta": {"lower": 0.0,"upper": 6.0}}}"""
43        with patch("builtins.open", mock_open(read_data=json_data)):
44            # only positive particles
45            test_str_pos = self.loader_pos.clean_tree()
46            expected_str_pos = "(0.0 <= Complex_pT < 2.0) and (0.0 <= Complex_eta < 6.0) and (0.0 <= Complex_p < 3.0) and (Complex_q > 0)"
47            test_str_neg = self.loader_anti.clean_tree()
48            expected_str_neg = "(0.0 <= Complex_pT < 2.0) and (0.0 <= Complex_eta < 6.0) and (0.0 <= Complex_p < 3.0) and (Complex_q < 0)"
49            self.assertEqual(test_str_pos, expected_str_pos)
50            self.assertEqual(test_str_neg, expected_str_neg)
def test_get_particles_type(self):
 52    def test_get_particles_type(self):
 53        proton_entry = {
 54            "Complex_q": 1,
 55            "Complex_p": 1,
 56            "Complex_pid": 2212,
 57            "Complex_mass2": 0.8,
 58        }
 59        proton_entry_specific_p = {
 60            "Complex_q": 1,
 61            "Complex_p": 2,
 62            "Complex_pid": 2212,
 63            "Complex_mass2": 0.79,
 64        }
 65        proton_entry_outside_1sigma = {
 66            "Complex_q": 1,
 67            "Complex_p": 1,
 68            "Complex_pid": 2212,
 69            "Complex_mass2": 3.8,
 70        }
 71        pion_entry = {
 72            "Complex_q": 1,
 73            "Complex_p": 1.2,
 74            "Complex_pid": 211,
 75            "Complex_mass2": 0.2,
 76        }
 77        complete_data = [
 78            proton_entry,
 79            proton_entry,
 80            proton_entry,
 81            proton_entry,
 82            proton_entry,
 83            proton_entry_specific_p,
 84            proton_entry_outside_1sigma,
 85            pion_entry,
 86        ]
 87        # mock json file for testing
 88        json_data = """{"var_names":{"momentum": "Complex_p","charge": "Complex_q", "mass2": "Complex_mass2", "pid": "Complex_pid"}}"""
 89        tree_handler = TreeHandler()
 90        tree_handler.set_data_frame(pd.DataFrame(complete_data))
 91        with patch("builtins.open", mock_open(read_data=json_data)):
 92            protons = self.loader_pos.get_particles_type(
 93                tree_handler, 2212, 1
 94            ).get_data_frame()
 95            # should find proton inside 1sigma region
 96            self.assertEqual(
 97                protons[
 98                    protons["Complex_mass2"] == proton_entry_specific_p["Complex_mass2"]
 99                ]["Complex_p"].iloc[0],
100                proton_entry_specific_p["Complex_p"],
101            )
102            # should filter out proton outside 1sigma region
103            pd.testing.assert_frame_equal(
104                protons[
105                    protons["Complex_mass2"]
106                    == proton_entry_outside_1sigma["Complex_mass2"]
107                ],
108                protons.drop(protons.index),
109            )
110            # should filter out pions
111            pd.testing.assert_frame_equal(
112                protons[protons["Complex_mass2"] == pion_entry["Complex_mass2"]],
113                protons.drop(protons.index),
114            )
def test_get_protons_kaons_pions(self):
116    def test_get_protons_kaons_pions(self):
117        proton_entry = {
118            "Complex_q": 1.0,
119            "Complex_p": 1.0,
120            "Complex_pid": 2212.0,
121            "Complex_mass2": 0.8,
122        }
123        kaon_entry = {
124            "Complex_q": 1.0,
125            "Complex_p": 1.2,
126            "Complex_pid": 321.0,
127            "Complex_mass2": 0.4,
128        }
129        pion_entry = {
130            "Complex_q": 1.0,
131            "Complex_p": 1.2,
132            "Complex_pid": 211.0,
133            "Complex_mass2": 0.2,
134        }
135        anti_proton_entry = {
136            "Complex_q": -1.0,
137            "Complex_p": 1.0,
138            "Complex_pid": -2212.0,
139            "Complex_mass2": 0.8,
140        }
141        anti_kaon_entry = {
142            "Complex_q": -1.0,
143            "Complex_p": 1.2,
144            "Complex_pid": -321.0,
145            "Complex_mass2": 0.4,
146        }
147        anti_pion_entry = {
148            "Complex_q": -1.0,
149            "Complex_p": 1.2,
150            "Complex_pid": -211.0,
151            "Complex_mass2": 0.2,
152        }
153        complete_data = [
154            proton_entry,
155            kaon_entry,
156            pion_entry,
157            anti_proton_entry,
158            anti_kaon_entry,
159            anti_pion_entry,
160        ]
161        # mock json file for testing
162        json_data = """{"var_names":{"momentum": "Complex_p", "charge": "Complex_q", "mass2": "Complex_mass2", "pid": "Complex_pid"}}"""
163        tree_handler = TreeHandler()
164        tree_handler.set_data_frame(pd.DataFrame(complete_data))
165        with patch("builtins.open", mock_open(read_data=json_data)):
166            protons, kaons, pions = self.loader_pos.get_protons_kaons_pions(
167                tree_handler
168            )
169            # check if each particle type was loaded correctly
170            pd.testing.assert_frame_equal(
171                protons.get_data_frame().reset_index(drop=True),
172                pd.DataFrame([proton_entry]).reset_index(drop=True),
173            )
174            pd.testing.assert_frame_equal(
175                kaons.get_data_frame().reset_index(drop=True),
176                pd.DataFrame([kaon_entry]).reset_index(drop=True),
177            )
178            pd.testing.assert_frame_equal(
179                pions.get_data_frame().reset_index(drop=True),
180                pd.DataFrame([pion_entry]).reset_index(drop=True),
181            )
182            # repeat for antiparticles
183            (
184                anti_protons,
185                anti_kaons,
186                anti_pions,
187            ) = self.loader_anti.get_protons_kaons_pions(tree_handler)
188            # check if each particle type was loaded correctly
189            pd.testing.assert_frame_equal(
190                anti_protons.get_data_frame().reset_index(drop=True),
191                pd.DataFrame([anti_proton_entry]).reset_index(drop=True),
192            )
193            pd.testing.assert_frame_equal(
194                anti_kaons.get_data_frame().reset_index(drop=True),
195                pd.DataFrame([anti_kaon_entry]).reset_index(drop=True),
196            )
197            pd.testing.assert_frame_equal(
198                anti_pions.get_data_frame().reset_index(drop=True),
199                pd.DataFrame([anti_pion_entry]).reset_index(drop=True),
200            )
def test_load_tree(self):
202    def test_load_tree(self):
203        with patch.object(LoadData, "clean_tree", return_value=''):
204            self.loader_pos.load_tree(self.plain_tree)
Inherited Members
unittest.case.TestCase
TestCase
addTypeEqualityFunc
addCleanup
addClassCleanup
tearDown
setUpClass
tearDownClass
countTestCases
defaultTestResult
shortDescription
id
subTest
run
doCleanups
doClassCleanups
debug
skipTest
fail
assertFalse
assertTrue
assertRaises
assertWarns
assertLogs
assertEqual
assertNotEqual
assertAlmostEqual
assertNotAlmostEqual
assertSequenceEqual
assertListEqual
assertTupleEqual
assertSetEqual
assertIn
assertNotIn
assertIs
assertIsNot
assertDictEqual
assertDictContainsSubset
assertCountEqual
assertMultiLineEqual
assertLess
assertLessEqual
assertGreater
assertGreaterEqual
assertIsNone
assertIsNotNone
assertIsInstance
assertNotIsInstance
assertRaisesRegex
assertWarnsRegex
assertRegex
assertNotRegex
failUnlessRaises
failIf
assertRaisesRegexp
assertRegexpMatches
assertNotRegexpMatches
failUnlessEqual
assertEquals
failIfEqual
assertNotEquals
failUnlessAlmostEqual
assertAlmostEquals
failIfAlmostEqual
assertNotAlmostEquals
failUnless
assert_