class_docstr: Test distribution.py.
docstr: Test function test_normality.
docstr_tok: ["Test","function","test_normality","."]
code: def test_normality(self):
      """Test function test_normality."""
      # List / 1D array
      normality(x, alpha=0.05)
      normality(x.tolist(), method="normaltest", alpha=0.05)
      # Pandas DataFrame
      df_nan_piv = df_nan.pivot(
          index="Subject", columns="Time", values="Scores"
      )
      normality(df_nan_piv)  # Wide-format dataframe
      normality(df_nan_piv["August"])  # pandas Series
      # The line below is disabled because test fails on python 3.5
      # assert stats_piv.equals(normality(df_nan, group='Time', dv='Scores'))
      normality(df_nan, group="Group", dv="Scores", method="normaltest")
      normality(
          df_nan, group="Group", dv="Scores", method="jarque_bera"
      )
      # Long-format but some groups are too small
      # https://github.com/raphaelvallat/pingouin/issues/319
      df_small = pd.DataFrame(
          {
              "group": [0, 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 3],
              "variable": [5, 6, 8, 9, 5, 5, 2, 3, 4, 5, np.nan, 8],
          }
      )
      stats = normality(df_small, dv="variable", group="group")
      assert np.isnan(stats.loc[[1, 3], "pval"]).all()
      assert not np.isnan(stats.loc[[0, 2], "pval"]).all()
      assert (~stats.loc[[1, 3], "normal"]).all()
  
file_path: pingouin/pingouin/tests/test_distribution.py
imports: import pytest
  import numpy
  import pandas
  from unittest import TestCase
  from pingouin.distribution import gzscore, normality, anderson, epsilon, homoscedasticity, sphericity
  from pingouin import read_dataset
label_desc: Use image node_id 2 for calling the TestDistribution obj's underlying member method code with example usage: obj.test_normality() without return types