Repository: PMEAL/OpenPNM
Pull request #412 (2015-06-28 17:27:48)

Yet more tests
As the title of the PR suggests, this PR is about increasing test coverage through the roof!


Patch:
diff --git a/.travis.yml b/.travis.yml
index e23be58bb..aa5e636ed 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,6 +5,8 @@ python:
     - '3.4'
 
 before_install:
+  - export DISPLAY=:99.0
+  - sh -e /etc/init.d/xvfb start
   - wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
   - chmod +x miniconda.sh
   - ./miniconda.sh -b
diff --git a/OpenPNM/Base/__Core__.py b/OpenPNM/Base/__Core__.py
index 65194a8d0..2280db0b3 100644
--- a/OpenPNM/Base/__Core__.py
+++ b/OpenPNM/Base/__Core__.py
@@ -157,13 +157,14 @@ class Core(dict):
 
     def clear(self):
         r"""
-        A subclassed version of the standard dict's clear method
+        A subclassed version of the standard dict's clear method.  This removes
+        ALL pore and throat properties and labels from the object, but keeps
+        empty versions of ``pore.all`` and ``throat.all`` which are required
+        for the object to still be functional.
         """
-        pall = self['pore.all']
-        tall = self['throat.all']
-        super(Core, self).clear()
-        self.update({'throat.all': tall})
-        self.update({'pore.all': pall})
+        super().clear()
+        self.update({'throat.all': sp.array([], ndmin=1, dtype=int)})
+        self.update({'pore.all': sp.array([], ndmin=1, dtype=int)})
 
     # -------------------------------------------------------------------------
     """Model Manipulation Methods"""
@@ -1412,9 +1413,9 @@ class Core(dict):
         locs = sp.array(locations, ndmin=1)
         if locs.dtype == bool:
             if sp.size(locs) == self.Np:
-                locs = self.Ps(locs)
+                locs = self.Ps[locs]
             elif sp.size(locs) == self.Nt:
-                locs = self.Ts(locs)
+                locs = self.Ts[locs]
             else:
                 raise Exception('List of locations is neither Np nor Nt long')
         return locs
diff --git a/OpenPNM/Base/__Tools__.py b/OpenPNM/Base/__Tools__.py
index 4fb812a63..2cde91970 100644
--- a/OpenPNM/Base/__Tools__.py
+++ b/OpenPNM/Base/__Tools__.py
@@ -34,24 +34,6 @@ class PrintableDict(_odict):
         return '\n'.join(lines)
 
 
-class AttributVeiew(object):
-    def __init__(self, d):
-        temp = {}
-        for item in d:
-            if type(d[item][0]) == _sp.bool_:
-                key = 'label_' + item.replace('.', '_')
-            else:
-                key = 'prop_' + item.replace('.', '_')
-            temp[key] = d[item]
-        self.__dict__ = temp
-
-
-class ClonedCore(dict):
-    def __init__(self, obj):
-        self.update(obj)
-        self.name = obj.name
-
-
 class HealthDict(PrintableDict):
     r"""
     This class adds a 'health' check to a standard dictionary.  This check
diff --git a/OpenPNM/Physics/__GenericPhysics__.py b/OpenPNM/Physics/__GenericPhysics__.py
index 1e172af5f..9f9aa5500 100644
--- a/OpenPNM/Physics/__GenericPhysics__.py
+++ b/OpenPNM/Physics/__GenericPhysics__.py
@@ -84,7 +84,6 @@ class GenericPhysics(OpenPNM.Base.Core):
         # Convert self.name into 'all'
         if key.split('.')[-1] == self.name:
             key = element + '.all'
-
         if key in self.keys():  # Look for data on self...
             return super(GenericPhysics, self).__getitem__(key)
         else:  # ...Then check Network
diff --git a/OpenPNM/Postprocessing/Plots.py b/OpenPNM/Postprocessing/Plots.py
index 978f99901..0fb6b20f7 100644
--- a/OpenPNM/Postprocessing/Plots.py
+++ b/OpenPNM/Postprocessing/Plots.py
@@ -11,16 +11,12 @@ def profiles(network, fig=None, values=None, bins=[10, 10, 10]):
     ----------
     network : OpenPNM Network object
 
-    values : array_like, optional
+    values : array_like
         The pore property values to be plotted as a profile
 
     bins : int or list of ints, optional
         The number of bins to divide the domain into for averaging.
 
-    Notes
-    -----
-    Either propname or values can be sent, but not both
-
     """
     if fig is None:
         fig = _plt.figure()


Test patch:
diff --git a/test/integration/script_test.py b/test/integration/script_test.py
index 3747d326c..b0e2075dd 100644
--- a/test/integration/script_test.py
+++ b/test/integration/script_test.py
@@ -259,66 +259,3 @@ def test_Darcy_alg():
     a = round(sp.absolute(Darcy2.rate(inlets))[0], 16)
     b = round(sp.absolute(Darcy2.rate(outlets))[0], 16)
     assert a == b
-
-
-def test_mapping():
-    # Create small cubic network
-    pn = OpenPNM.Network.Cubic(shape=[3, 3, 3], spacing=0.0001)
-    # Assign 3 different geometries to each layer in the z-direction
-    Pa = sp.arange(0, 9)
-    Ta = pn.find_neighbor_throats(Pa)
-    geom1 = OpenPNM.Geometry.GenericGeometry(network=pn, pores=Pa, throats=Ta)
-    Pc = sp.arange(18, 27)
-    Tc = pn.find_neighbor_throats(Pc)
-    geom3 = OpenPNM.Geometry.GenericGeometry(network=pn, pores=Pc, throats=Tc)
-    Pb = sp.arange(9, 18)
-    Tb = pn.find_neighbor_throats(pores=Pb, mode='intersection')
-    geom2 = OpenPNM.Geometry.GenericGeometry(network=pn, pores=Pb, throats=Tb)
-    # Create an index in the Network
-    pn['pore.num1'] = pn.Ps
-    # Create the same index across each geom
-    geom1['pore.num2'] = Pa
-    geom2['pore.num2'] = Pb
-    geom3['pore.num2'] = Pc
-    # Confirm two indexes match
-    assert(sp.all(pn['pore.num1'] == pn['pore.num2']))
-    # Send junk pores to ensure error is raised
-    with pytest.raises(Exception):
-        pn.map_pores(pores=[0, pn.Np-1], target=geom1)
-        pn.map_pores(pores=[0, pn.Np+1], target=geom1)
-        pn.map_pores(pores=[pn.Np-1], target=geom1)
-        pn.map_pores(pores=[pn.Np+1], target=geom1)
-        geom1.map_pores(pores=[0, geom1.Np+1], target=pn)
-        geom1.map_pores(pores=[0, pn.Np+1], target=pn)
-        geom1.map_pores(pores=[geom1.Np+1], target=pn)
-        geom1.map_pores(pores=[pn.Np+1], target=pn)
-        geom2.map_pores(pores=[0], target=geom1)
-        geom2.map_pores(pores=[geom2.Np+1], target=geom1)
-        geom2.map_pores(pores=[0, geom2.Np-1], target=geom1)
-        geom2.map_pores(pores=[0, geom2.Np+1], target=geom1)
-    # Trim column from center of Network
-    pn.trim(pores=[4, 13, 22])
-    # Confirm index still match
-    assert(sp.all(pn['pore.num1'] == pn['pore.num2']))
-    # Check mapping between each Geometry object and in both directions
-    # Check geom1
-    a = geom1.map_pores(pores=geom1.Ps, target=pn)
-    b = pn.map_pores(pores=a, target=geom1)
-    assert(sp.all(b == geom1.Ps))
-    a = geom1.map_throats(throats=geom1.Ts, target=pn)
-    b = pn.map_throats(throats=a, target=geom1)
-    assert(sp.all(b == geom1.Ts))
-    # Check geom2
-    a = geom2.map_pores(pores=geom2.Ps, target=pn)
-    b = pn.map_pores(pores=a, target=geom2)
-    assert(sp.all(b == geom2.Ps))
-    a = geom2.map_throats(throats=geom2.Ts, target=pn)
-    b = pn.map_throats(throats=a, target=geom2)
-    assert(sp.all(b == geom2.Ts))
-    # Check geom3
-    a = geom3.map_pores(pores=geom3.Ps, target=pn)
-    b = pn.map_pores(pores=a, target=geom3)
-    assert(sp.all(b == geom3.Ps))
-    a = geom3.map_throats(throats=geom3.Ts, target=pn)
-    b = pn.map_throats(throats=a, target=geom3)
-    assert(sp.all(b == geom3.Ts))
diff --git a/test/integration/test_percolation_algorithms.py b/test/integration/test_percolation_algorithms.py
index e509392ae..baa5a7090 100644
--- a/test/integration/test_percolation_algorithms.py
+++ b/test/integration/test_percolation_algorithms.py
@@ -1,4 +1,5 @@
 import scipy as sp
+import matplotlib
 import OpenPNM
 import pytest
 ctrl = OpenPNM.Base.Controller()
@@ -104,3 +105,20 @@ def test_OP_trapping():
     V_tot = sp.sum(pn['pore.volume'])
     assert V_inv/V_tot < 1.0
     ctrl.clear()
+
+
+def test_OP_plotting():
+    ctrl.clear()
+    pn = OpenPNM.Network.Cubic(shape=[30, 30, 1], spacing=0.01)
+    geom = OpenPNM.Geometry.Toray090(network=pn, pores=pn.Ps, throats=pn.Ts)
+    water = OpenPNM.Phases.Water(network=pn)
+    OpenPNM.Physics.Standard(network=pn, phase=water, geometry=geom)
+    inlets = pn.pores('left')
+    OP = OpenPNM.Algorithms.OrdinaryPercolation(network=pn)
+    OP.setup(invading_phase=water)
+    OP.set_inlets(pores=inlets)
+    OP.run(npts=25)
+    a = OP.plot_drainage_curve()
+    assert isinstance(a, matplotlib.figure.Figure)
+    a = OP.plot_primary_drainage_curve()
+    assert isinstance(a, matplotlib.figure.Figure)
diff --git a/test/unit/Algorithms/OrdinaryPercolationTest.py b/test/unit/Algorithms/OrdinaryPercolationTest.py
index e4db3820f..6a4566d9d 100644
--- a/test/unit/Algorithms/OrdinaryPercolationTest.py
+++ b/test/unit/Algorithms/OrdinaryPercolationTest.py
@@ -1,3 +1,15 @@
+import OpenPNM
+ctrl = OpenPNM.Base.Controller()
+ctrl.loglevel = 60
+
+
 class OrdinaryPercolationTest:
-    def test_do_outer_iteration_stage(self):
-        pass
+    def setup_test(self):
+        self.net = OpenPNM.Network.Cubic(shape=[5, 5, 5])
+        self.geo = OpenPNM.Geometry.Toray090(network=self.net,
+                                             pores=self.net.Ps,
+                                             throats=self.net.Ts)
+        self.phase = OpenPNM.Phases.Water(network=self.net)
+        self.phys = OpenPNM.Physics.Standard(network=self.net,
+                                             pores=self.net.Ps,
+                                             throats=self.net.Ts)
diff --git a/test/unit/Base/CoreTest.py b/test/unit/Base/CoreTest.py
index 96f807c34..2706db4f4 100644
--- a/test/unit/Base/CoreTest.py
+++ b/test/unit/Base/CoreTest.py
@@ -1,5 +1,6 @@
 import OpenPNM
 import scipy as sp
+import pytest
 ctrl = OpenPNM.Base.Controller()
 ctrl.loglevel = 60
 
@@ -32,6 +33,32 @@ class CoreTest:
         self.phys2 = OpenPNM.Physics.GenericPhysics(network=self.net1,
                                                     geometry=self.geo1,
                                                     phase=self.phase2)
+        self.net2 = OpenPNM.Network.Cubic(shape=[3, 3, 3])
+        Ps = sp.arange(0, 18)
+        Ts = self.net2.find_neighbor_pores(Ps, mode='union')
+        self.geo21 = OpenPNM.Geometry.GenericGeometry(network=self.net2,
+                                                      pores=Ps,
+                                                      throats=Ts)
+        Ps = sp.arange(18, 27)
+        Ts = self.net2.find_neighbor_pores(Ps, mode='intersection')
+        self.geo22 = OpenPNM.Geometry.GenericGeometry(network=self.net2,
+                                                      pores=Ps,
+                                                      throats=Ts)
+
+    def test_clear(self):
+        net = OpenPNM.Network.Cubic(shape=[3, 3, 3])
+        b = sorted(list(net.keys()))
+        dict_ = net.copy()
+        net.clear()
+        assert net.Np == 0
+        assert net.Nt == 0
+        a = sorted(list(net.keys()))
+        assert a == ['pore.all', 'throat.all']
+        net.update(dict_)
+        assert net.Np == 27
+        assert net.Nt == 54
+        a = sorted(list(net.keys()))
+        assert a == b
 
     def test_props_all(self):
         a = self.geo.props()
@@ -282,6 +309,10 @@ class CoreTest:
             pass
         assert a is None
 
+    def test_count(self):
+        a = self.net._count()
+        assert a == {'pore': 27, 'throat': 54}
+
     def test_num_pores(self):
         a = self.net.num_pores()
         assert a == 27
@@ -413,6 +444,14 @@ class CoreTest:
         a = self.net1.geometries(self.geo1.name)
         assert a == [self.geo1]
 
+    def test_set_locations_on_phase(self):
+        flag = False
+        try:
+            self.phase1._set_locations(element='pores', locations=1)
+        except:
+            flag = True
+        assert flag
+
     def test_set_locations_add_on_empty_geometry(self):
         # 'empty' meaning assigned nowhere, with no models or props
         net = OpenPNM.Network.Cubic(shape=[3, 3, 3])
@@ -548,3 +587,202 @@ class CoreTest:
         assert sp.size(geo['pore.regenerating_model']) == 18
         del ctrl[net.name]
         del ctrl[geo.name]
+
+    def test_find_all_physics(self):
+        a = self.net1.physics()
+        b = [self.phys1.name, self.phys2.name]
+        assert a == b
+
+    def test_find_physics_by_name(self):
+        a = self.net1.physics(self.phys1.name)
+        assert self.phys1 in a
+        assert self.phys2 not in a
+        a = self.net1.physics([self.phys1.name, self.phys2.name])
+        assert self.phys1 in a
+        assert self.phys2 in a
+
+    def test_find_all_phases(self):
+        a = self.net1.phases()
+        b = [self.phase1.name, self.phase2.name]
+        assert a == b
+
+    def test_find_phases_by_name(self):
+        a = self.net1.phases(self.phase1.name)
+        assert self.phase1 in a
+        assert self.phase2 not in a
+        a = self.net1.phases([self.phase1.name, self.phase2.name])
+        assert self.phase1 in a
+        assert self.phase2 in a
+
+    def test_find_all_geometries(self):
+        a = self.net1.geometries()
+        b = [self.geo1.name]
+        assert a == b
+
+    def test_find_geometries_by_name(self):
+        a = self.net1.phases(self.phase1.name)
+        assert self.phase1 in a
+        assert self.phase2 not in a
+        a = self.net1.phases([self.phase1.name, self.phase2.name])
+        assert self.phase1 in a
+        assert self.phase2 in a
+
+    def test_find_network_from_geometry(self):
+        a = self.geo.network()
+        assert a == [self.net]
+
+    def test_find_network_by_name_from_geometry(self):
+        a = self.geo.network(self.net.name)
+        assert a == self.net
+
+    def test_find_network_from_phase(self):
+        a = self.phase1.network()
+        assert a == [self.net1]
+
+    def test_find_network_by_name_from_phase(self):
+        a = self.phase1.network(self.net1.name)
+        assert a == self.net1
+
+    def test_find_network_from_physics(self):
+        a = self.phys1.network()
+        assert a == [self.net1]
+
+    def test_find_network_by_name_from_physics(self):
+        a = self.phys1.network(self.net1.name)
+        assert a == self.net1
+
+    def test_object_print(self):
+        a = self.net.__str__()
+        assert type(a) == str
+
+    def test_object_representation(self):
+        a = self.net.__repr__()
+        assert type(a) == str
+
+    def test_parse_locations_int(self):
+        a = self.net._parse_locations(locations=0)
+        assert type(a) == sp.ndarray
+        assert sp.all(a == 0)
+
+    def test_parse_locations_list(self):
+        a = self.net._parse_locations(locations=[0, 1])
+        assert type(a) == sp.ndarray
+        assert sp.all(a == [0, 1])
+
+    def test_parse_locations_bool_pores(self):
+        a = self.net._parse_locations(locations=sp.ones([self.net.Np, ],
+                                                        dtype=bool))
+        assert sp.all(a == self.net.Ps)
+
+    def test_parse_locations_bool_throat(self):
+        a = self.net._parse_locations(locations=sp.ones([self.net.Nt, ],
+                                                        dtype=bool))
+        assert sp.all(a == self.net.Ts)
+
+    def test_parse_locations_bool_wrong_length(self):
+        flag = False
+        try:
+            self.net._parse_locations(locations=sp.ones([self.net.Nt+1, ],
+                                                        dtype=bool))
+        except:
+            flag = True
+        assert flag
+
+    def test_map_pores_geometry1_onto_network(self):
+        a = self.geo21.map_pores(target=self.net2)
+        assert sp.all(a == self.net2.pores(self.geo21.name))
+
+    def test_map_pores_geometry2_onto_network(self):
+        a = self.geo22.map_pores(target=self.net2, pores=self.geo22.Ps)
+        assert sp.all(a == self.net2.pores(self.geo22.name))
+
+    def test_map_pores_network_onto_self(self):
+        a = self.net2.map_pores(target=self.net2)
+        assert sp.all(a == self.net2.pores())
+
+    def test_map_pores_geometry_onto_other_geometry(self):
+        flag = False
+        try:
+            self.geo21.map_pores(target=self.geo22)
+        except:
+            flag = True
+        assert flag
+
+    def test_mapping(self):
+        # Create small cubic network
+        pn = OpenPNM.Network.Cubic(shape=[3, 3, 3], spacing=0.0001)
+        # Assign 3 different geometries to each layer in the z-direction
+        Pa = sp.arange(0, 9)
+        Ta = pn.find_neighbor_throats(Pa)
+        geom1 = OpenPNM.Geometry.GenericGeometry(network=pn,
+                                                 pores=Pa,
+                                                 throats=Ta)
+        Pc = sp.arange(18, 27)
+        Tc = pn.find_neighbor_throats(Pc)
+        geom3 = OpenPNM.Geometry.GenericGeometry(network=pn,
+                                                 pores=Pc,
+                                                 throats=Tc)
+        Pb = sp.arange(9, 18)
+        Tb = pn.find_neighbor_throats(pores=Pb, mode='intersection')
+        geom2 = OpenPNM.Geometry.GenericGeometry(network=pn,
+                                                 pores=Pb,
+                                                 throats=Tb)
+        # Create an index in the Network
+        pn['pore.num1'] = pn.Ps
+        # Create the same index across each geom
+        geom1['pore.num2'] = Pa
+        geom2['pore.num2'] = Pb
+        geom3['pore.num2'] = Pc
+        # Confirm two indexes match
+        assert(sp.all(pn['pore.num1'] == pn['pore.num2']))
+        # Send junk pores to ensure error is raised
+        with pytest.raises(Exception):
+            pn.map_pores(pores=[0, pn.Np-1], target=geom1)
+            pn.map_pores(pores=[0, pn.Np+1], target=geom1)
+            pn.map_pores(pores=[pn.Np-1], target=geom1)
+            pn.map_pores(pores=[pn.Np+1], target=geom1)
+            geom1.map_pores(pores=[0, geom1.Np+1], target=pn)
+            geom1.map_pores(pores=[0, pn.Np+1], target=pn)
+            geom1.map_pores(pores=[geom1.Np+1], target=pn)
+            geom1.map_pores(pores=[pn.Np+1], target=pn)
+            geom2.map_pores(pores=[0], target=geom1)
+            geom2.map_pores(pores=[geom2.Np+1], target=geom1)
+            geom2.map_pores(pores=[0, geom2.Np-1], target=geom1)
+            geom2.map_pores(pores=[0, geom2.Np+1], target=geom1)
+        # Trim column from center of Network
+        pn.trim(pores=[4, 13, 22])
+        # Confirm index still match
+        assert(sp.all(pn['pore.num1'] == pn['pore.num2']))
+        # Check mapping between each Geometry object and in both directions
+        # Check geom1
+        a = geom1.map_pores(pores=geom1.Ps, target=pn)
+        b = pn.map_pores(pores=a, target=geom1)
+        assert(sp.all(b == geom1.Ps))
+        a = geom1.map_throats(throats=geom1.Ts, target=pn)
+        b = pn.map_throats(throats=a, target=geom1)
+        assert(sp.all(b == geom1.Ts))
+        # Check geom2
+        a = geom2.map_pores(pores=geom2.Ps, target=pn)
+        b = pn.map_pores(pores=a, target=geom2)
+        assert(sp.all(b == geom2.Ps))
+        a = geom2.map_throats(throats=geom2.Ts, target=pn)
+        b = pn.map_throats(throats=a, target=geom2)
+        assert(sp.all(b == geom2.Ts))
+        # Check geom3
+        a = geom3.map_pores(pores=geom3.Ps, target=pn)
+        b = pn.map_pores(pores=a, target=geom3)
+        assert(sp.all(b == geom3.Ps))
+        a = geom3.map_throats(throats=geom3.Ts, target=pn)
+        b = pn.map_throats(throats=a, target=geom3)
+        assert(sp.all(b == geom3.Ts))
+
+    def check_data_health(self):
+        a = self.net.check_data_health()
+        assert a.health
+        for item in a.values():
+            assert item == []
+        self.net['pore.data_test'] = sp.nan
+        a = self.net.check_data_health()
+        assert not a.health
+        assert a['pore.data_test'] == 'Has NaNs'
+        del self.net['pore.data_test']
diff --git a/test/unit/Base/ToolsTest.py b/test/unit/Base/ToolsTest.py
index 0fcb5c4ae..adb56f662 100644
--- a/test/unit/Base/ToolsTest.py
+++ b/test/unit/Base/ToolsTest.py
@@ -31,3 +31,7 @@ class ToolsTest:
                 'second_key                second_value\n' + \
                 '------------------------------------------------------------'
             assert actual_string == expected_string
+
+        def test_representation(self):
+            a = self.dict.__repr__()
+            assert type(a) is str
diff --git a/test/unit/Geometry/GenericGeometryTest.py b/test/unit/Geometry/GenericGeometryTest.py
index da043584b..f492d011c 100644
--- a/test/unit/Geometry/GenericGeometryTest.py
+++ b/test/unit/Geometry/GenericGeometryTest.py
@@ -46,3 +46,18 @@ class GenericGeometryTest:
         a = self.geo.pores(self.geo.name)
         b = self.geo.Ps
         assert sp.all(a == b)
+
+    def test_get_item_self_name(self):
+        a = self.geo.get('pore.'+self.geo.name)
+        assert a is None
+        a = self.geo['pore.'+self.geo.name]
+        assert sp.sum(a) == self.geo.Np
+
+    def test_initialize_with_overlapping_locations(self):
+        flag = False
+        try:
+            OpenPNM.Geometry.GenericGeometry(network=self.net,
+                                             pores=[0])
+        except:
+            flag = True
+        assert flag
diff --git a/test/unit/Phases/models/VaporPressureTest.py b/test/unit/Phases/models/VaporPressureTest.py
index d56e6bde6..738c8c28d 100644
--- a/test/unit/Phases/models/VaporPressureTest.py
+++ b/test/unit/Phases/models/VaporPressureTest.py
@@ -26,3 +26,13 @@ class VaporPressureTest:
                               pore_temperature='pore.temperature',
                               pore_salinity='pore.salinity')
         assert sp.allclose(self.phase['pore.test'], 3536.01)
+
+    def test_water_no_salinity(self):
+        f = OpenPNM.Phases.models.vapor_pressure.water
+        del self.phase['pore.salinity']
+        self.phase.models.add(propname='pore.test',
+                              model=f,
+                              pore_temperature='pore.temperature',
+                              pore_salinity='pore.salinity')
+        assert sp.allclose(self.phase['pore.test'], 3536.01)
+        self.phase['pore.salinity'] = sp.zeros((self.phase.Np,))
diff --git a/test/unit/Physics/GenericPhysicsTest.py b/test/unit/Physics/GenericPhysicsTest.py
index 76e1523a0..3136015f1 100644
--- a/test/unit/Physics/GenericPhysicsTest.py
+++ b/test/unit/Physics/GenericPhysicsTest.py
@@ -1,4 +1,5 @@
 import OpenPNM
+import scipy as sp
 
 
 class GenericPhysicsTest:
@@ -17,3 +18,41 @@ class GenericPhysicsTest:
                                                      throats=T2)
         self.phase1 = OpenPNM.Phases.GenericPhase(network=self.net)
         self.phase2 = OpenPNM.Phases.GenericPhase(network=self.net)
+        self.phys1 = OpenPNM.Physics.GenericPhysics(network=self.net,
+                                                    phase=self.phase1,
+                                                    geometry=self.geo1)
+
+    def test_specify_pores_and_geometry(self):
+        flag = False
+        try:
+            OpenPNM.Physics.GenericPhysics(network=self.net,
+                                           phase=self.phase1,
+                                           geometry=self.geo1,
+                                           pores=[0])
+        except:
+            flag = True
+        assert flag
+
+    def test_specify_overlapping_pores(self):
+        flag = False
+        try:
+            OpenPNM.Physics.GenericPhysics(network=self.net,
+                                           pores=[0])
+        except:
+            flag = True
+        assert flag
+
+    def test_specify_overlapping_geometry(self):
+        flag = False
+        try:
+            OpenPNM.Physics.GenericPhysics(network=self.net,
+                                           geometry=self.geo1)
+        except:
+            flag = True
+        assert flag
+
+    def test_get_item_self_name(self):
+        a = self.phys1.get('pore.'+self.phys1.name)
+        assert a is None
+        a = self.phys1['pore.'+self.phys1.name]
+        assert sp.sum(a) == self.phys1.Np
diff --git a/test/unit/Postprocessing/PlotsTest.py b/test/unit/Postprocessing/PlotsTest.py
index f25909fc3..d84390e72 100644
--- a/test/unit/Postprocessing/PlotsTest.py
+++ b/test/unit/Postprocessing/PlotsTest.py
@@ -1,3 +1,50 @@
+import OpenPNM
+import matplotlib as mpl
+
+
 class PlotsTest:
-    def test_profiles(self):
-        pass
+    def setup_class(self):
+        self.net = OpenPNM.Network.Cubic(shape=[10, 10, 10])
+        self.geo = OpenPNM.Geometry.Toray090(network=self.net,
+                                             pores=self.net.Ps,
+                                             throats=self.net.Ts)
+        self.water = OpenPNM.Phases.Water(network=self.net)
+        self.phys = OpenPNM.Physics.Standard(network=self.net,
+                                             phase=self.water,
+                                             geometry=self.geo)
+        self.IP = OpenPNM.Algorithms.InvasionPercolation(network=self.net)
+        self.IP.setup(phase=self.water)
+        self.IP.set_inlets(self.net.pores('top'))
+        self.IP.run()
+
+    def test_distributions(self):
+        a = OpenPNM.Postprocessing.Plots.distributions(self.net)
+        assert isinstance(a, mpl.figure.Figure)
+
+    def test_pore_size_distribution(self):
+        a = OpenPNM.Postprocessing.Plots.pore_size_distribution(self.net)
+        assert isinstance(a, mpl.figure.Figure)
+
+    def test_porosity_profile_axis_0(self):
+        a = OpenPNM.Postprocessing.Plots.porosity_profile(self.net, axis=0)
+        assert isinstance(a, mpl.figure.Figure)
+
+    def test_porosity_profile_axis_2(self):
+        a = OpenPNM.Postprocessing.Plots.porosity_profile(self.net, axis=1)
+        assert isinstance(a, mpl.figure.Figure)
+
+    def test_porosity_profile_axis_3(self):
+        a = OpenPNM.Postprocessing.Plots.porosity_profile(self.net, axis=2)
+        assert isinstance(a, mpl.figure.Figure)
+
+#    def test_profiles(self):
+#        vals = self.geo['pore.diameter']
+#        a = OpenPNM.Postprocessing.Plots.profiles(self.net, values=vals)
+#        assert isinstance(a, mpl.figure.Figure)
+#
+#    def test_saturation_profile(self):
+#        self.water['pore.occupancy'] = self.IP['pore.invaded'] < 500
+#        self.water['throat.occupancy'] = self.IP['throat.invaded'] < 500
+#        a = OpenPNM.Postprocessing.Plots.saturation_profile(self.net,
+#                                                            phase=self.water)
+#        assert isinstance(a, mpl.figure.Figure)