On 19/07/2017 18:42, Steven D'Aprano wrote:
On Wed, Jul 19, 2017 at 05:01:53PM +0200, Sydney Shall wrote:

[...]
  def test_zero_in_capitalsadvanced(self):
         self.assertIn(self.capitalsadvanced, 0.0)

The error message is:

Traceback (most recent call last):
[...]
in assertIn
     if member not in container:
TypeError: argument of type 'float' is not iterable

You are trying to test whether capitalsadvanced is in 0.0. Reverse the
arguments:

         self.assertIn(0.0, self.capitalsadvanced)

which will test whether 0.0 is in self.capitalsadvanced.


FAILED (failures=9, errors=1)

The failures all arise from a 'nan'.
It is this problem that I am trying to resolve.

Well, since you don't show us what those failing tests are, we cannot
possibly tell you how to fix them.

Start by showing us *one* failing test, and what the failure is.


Thank you Steve.

The remaining 'nan' problems are shown below.

runfile('/Users/sydney/Capital/Capital_with_productivity/Current_Versions/testPOCWP_V2.py', wdir='/Users/sydney/Capital/Capital_with_productivity/Current_Versions') /Users/sydney/Capital/Capital_with_productivity/Current_Versions/PopulationOfCapitalsWithProductivityV16_Python36.py:1582: RuntimeWarning: invalid value encountered in true_divide

/Users/sydney/Capital/Capital_with_productivity/Current_Versions/PopulationOfCapitalsWithProductivityV16_Python36.py:1637: RuntimeWarning: invalid value encountered in true_divide
  constantcapitals is divided, element-wise by the array
/Users/sydney/Capital/Capital_with_productivity/Current_Versions/PopulationOfCapitalsWithProductivityV16_Python36.py:1665: RuntimeWarning: invalid value encountered in true_divide
  capitalsadvanced.
/Users/sydney/Capital/Capital_with_productivity/Current_Versions/PopulationOfCapitalsWithProductivityV16_Python36.py:1695: RuntimeWarning: invalid value encountered in true_divide
  The output is a numpy array of floats; and they are ratios of (Variable
/Users/sydney/Capital/Capital_with_productivity/Current_Versions/PopulationOfCapitalsWithProductivityV16_Python36.py:1729: RuntimeWarning: invalid value encountered in true_divide
  The method returns is a numpy array of floats; the ratios of (Variable
/Users/sydney/Capital/Capital_with_productivity/Current_Versions/PopulationOfCapitalsWithProductivityV16_Python36.py:1758: RuntimeWarning: invalid value encountered in true_divide
  The method returns a numpy array of floats, which are the ratios of
/Users/sydney/Capital/Capital_with_productivity/Current_Versions/PopulationOfCapitalsWithProductivityV16_Python36.py:1787: RuntimeWarning: invalid value encountered in true_divide
  The method returns a numpy array of floats which are the individual
/Users/sydney/Capital/Capital_with_productivity/Current_Versions/PopulationOfCapitalsWithProductivityV16_Python36.py:1816: RuntimeWarning: invalid value encountered in true_divide
  The method returns a numpy array of floats which are the ratios of (New
..............................................................................................................FF.F.FFF..FF...F......./Users/sydney/anaconda/lib/python3.6/unittest/case.py:1077: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if member not in container:
F............................................../Users/sydney/Capital/Capital_with_productivity/Current_Versions/PopulationOfCapitalsWithProductivityV16_Python36.py:2311: RuntimeWarning: invalid value encountered in double_scalars
  values in UCC.
/Users/sydney/Capital/Capital_with_productivity/Current_Versions/PopulationOfCapitalsWithProductivityV16_Python36.py:2256: RuntimeWarning: invalid value encountered in double_scalars

....................................................................

I have looked carefully at the lines indicated and they almost all involve 4 specific numpy.ndarrays. I suspect from the logic that they all results from the commonest array in the list.

The last error is different, but I belie that it is related.



--
Sydney
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to