def test_component_current_component_values(self, only_free, only_active):
     "Many decimals aren't printed, few decimals are"
     string_representation = str(current_component_values(self.component, only_free, only_active).__repr__())
     html_representation = str(current_component_values(self.component, only_free, only_active)._repr_html_())
     assert "1.234" in string_representation
     assert "1.23456789012" not in string_representation
     assert "1.234" in html_representation
     assert "1.23456789012" not in html_representation
Exemple #2
0
 def test_component_current_component_values_only_free(
         self, only_free=True, only_active=False):
     "Parameters with free=False values should not be present in repr"
     string_representation = str(
         current_component_values(self.component_not_free, only_free,
                                  only_active).__repr__())
     html_representation = str(
         current_component_values(self.component_not_free, only_free,
                                  only_active)._repr_html_())
     assert "9.87" not in string_representation
     assert "9.87" not in html_representation
Exemple #3
0
 def print_current_values(self, only_free=False, fancy=True):
     """Prints the current values of the component's parameters.
     Parameters
     ----------
     only_free : bool
         If True, only free parameters will be printed.
     fancy : bool
         If True, attempts to print using html rather than text in the notebook.
     """
     if fancy:
         display(current_component_values(self, only_free=only_free))
     else:
         display_pretty(current_component_values(self, only_free=only_free))
Exemple #4
0
 def test_twinned_in_print(self):
     assert "             A | Twinned |" in str(
         current_component_values(self.model[2]).__repr__()).split('\n')[4]
Exemple #5
0
 def test_zero_in_normal_print(self):
     "Ensure parameters with value=0 are printed too"
     assert "            a0 |    True |          0 |" in str(
         current_component_values(self.model[0]).__repr__)
Exemple #6
0
 def test_zero_in_fancy_print(self):
     "Ensure parameters with value=0 are printed too"
     assert "<td>a1</td><td>True</td><td>     0</td>" in current_component_values(
         self.model[0])._repr_html_()