
import libvirt

globals = dir(libvirt)

# Sanity test that the generator hasn't gone wrong

# Look for core classes
assert("virConnect" in globals)
assert("virDomain" in globals)
assert("virDomainSnapshot" in globals)
assert("virInterface" in globals)
assert("virNWFilter" in globals)
assert("virNodeDevice" in globals)
assert("virNetwork" in globals)
assert("virSecret" in globals)
assert("virStoragePool" in globals)
assert("virStorageVol" in globals)
assert("virStream" in globals)
assert("VIR_CONNECT_RO" in globals)

# Error related bits
assert("libvirtError" in globals)
assert("VIR_ERR_AUTH_FAILED" in globals)
assert("virGetLastError" in globals)

# Some misc methods
assert("virInitialize" in globals)
assert("virEventAddHandle" in globals)
assert("virEventRegisterDefaultImpl" in globals)


import libvirt

globals = dir(libvirt)

# Sanity test that the generator hasn't gone wrong

# Look for core classes
for clsname in ["virConnect",
                "virDomain",
                "virDomainSnapshot",
                "virInterface",
                "virNWFilter",
                "virNodeDevice",
                "virNetwork",
                "virSecret",
                "virStoragePool",
                "virStorageVol",
                "virStream",
                ]:
    assert(clsname in globals)
    assert(object in getattr(libvirt, clsname).__bases__)

# Constants
assert("VIR_CONNECT_RO" in globals)

# Error related bits
assert("libvirtError" in globals)
assert("VIR_ERR_AUTH_FAILED" in globals)
assert("virGetLastError" in globals)

# Some misc methods
assert("virInitialize" in globals)
assert("virEventAddHandle" in globals)
assert("virEventRegisterDefaultImpl" in globals)

Check if classes are derived from object
Check if classes are derived from object

This makes sure we don't regress to old style classes

  
  import libvirt
  
  globals = dir(libvirt)
  
  # Sanity test that the generator hasn't gone wrong
  
  # Look for core classes
- assert("virConnect" in globals)
- assert("virDomain" in globals)
- assert("virDomainSnapshot" in globals)
- assert("virInterface" in globals)
- assert("virNWFilter" in globals)
- assert("virNodeDevice" in globals)
- assert("virNetwork" in globals)
- assert("virSecret" in globals)
- assert("virStoragePool" in globals)
- assert("virStorageVol" in globals)
- assert("virStream" in globals)
+ for clsname in ["virConnect",
+                 "virDomain",
+                 "virDomainSnapshot",
+                 "virInterface",
+                 "virNWFilter",
+                 "virNodeDevice",
+                 "virNetwork",
+                 "virSecret",
+                 "virStoragePool",
+                 "virStorageVol",
+                 "virStream",
+                 ]:
+     assert(clsname in globals)
+     assert(object in getattr(libvirt, clsname).__bases__)
+ 
+ # Constants
  assert("VIR_CONNECT_RO" in globals)
  
  # Error related bits
  assert("libvirtError" in globals)
  assert("VIR_ERR_AUTH_FAILED" in globals)
  assert("virGetLastError" in globals)
  
  # Some misc methods
  assert("virInitialize" in globals)
  assert("virEventAddHandle" in globals)
  assert("virEventRegisterDefaultImpl" in globals)
  
Check if classes are derived from object
## Code Before:

import libvirt

globals = dir(libvirt)

# Sanity test that the generator hasn't gone wrong

# Look for core classes
assert("virConnect" in globals)
assert("virDomain" in globals)
assert("virDomainSnapshot" in globals)
assert("virInterface" in globals)
assert("virNWFilter" in globals)
assert("virNodeDevice" in globals)
assert("virNetwork" in globals)
assert("virSecret" in globals)
assert("virStoragePool" in globals)
assert("virStorageVol" in globals)
assert("virStream" in globals)
assert("VIR_CONNECT_RO" in globals)

# Error related bits
assert("libvirtError" in globals)
assert("VIR_ERR_AUTH_FAILED" in globals)
assert("virGetLastError" in globals)

# Some misc methods
assert("virInitialize" in globals)
assert("virEventAddHandle" in globals)
assert("virEventRegisterDefaultImpl" in globals)

## Instruction:
Check if classes are derived from object
## Code After:

import libvirt

globals = dir(libvirt)

# Sanity test that the generator hasn't gone wrong

# Look for core classes
for clsname in ["virConnect",
                "virDomain",
                "virDomainSnapshot",
                "virInterface",
                "virNWFilter",
                "virNodeDevice",
                "virNetwork",
                "virSecret",
                "virStoragePool",
                "virStorageVol",
                "virStream",
                ]:
    assert(clsname in globals)
    assert(object in getattr(libvirt, clsname).__bases__)

# Constants
assert("VIR_CONNECT_RO" in globals)

# Error related bits
assert("libvirtError" in globals)
assert("VIR_ERR_AUTH_FAILED" in globals)
assert("virGetLastError" in globals)

# Some misc methods
assert("virInitialize" in globals)
assert("virEventAddHandle" in globals)
assert("virEventRegisterDefaultImpl" in globals)
